Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't let rustc-dep-of-std enable backtrace-sys #297

Merged
merged 1 commit into from
Mar 2, 2020

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Mar 1, 2020

Fixes #253

@alexcrichton
Copy link
Member

I sort of forget the context for this at this point again, but is this somethign that we can condition the target string on? For example could a new target be added to print out the empty cfg? Or is this required as part of a build elsewhere or something like that?

@RalfJung
Copy link
Member Author

RalfJung commented Mar 2, 2020

The point of this is to be able to do a cross check build of libstd without the backtrace feature for foreign architectures with only a Rust toolchain. This is needed for rust-lang/miri#1198: since Miri is just an interpreter, in principle we should be able to emulate any target platform on any host platform. Since recently Miri just does check builds for everything, so rust-lang/rust#56443 is not a problem any more.

The only thing that still fails when I run xargo-check check --target x86_64-apple-darwin on my Linux box is that, even though the backtrace feature in libstd is disabled, libstd still depends on backtrace-sys (transitively) and its build script fails (as I have no apple toolchain and headers installed).

libstd without the backtrace feature depends on an "empty" backtrace with no features (you requested that in rust-lang/rust#64444 to avoid lots of cfg in libstd). Unfortunately, due to cargo limitations, the fact that backtrace forwards the rustc-dep-of-std feature to backtrace-sys means that the rustc-dep-of-std backtrace feature implicitly enables backtrace-sys. So, that "empty" backtrace crate is actually not quite so empty when rustc-dep-of-std is enabled.

is this somethign that we can condition the target string on

I don't follow... how would we condition the target string on anything? We don't control the target string?

@alexcrichton
Copy link
Member

Ah ok that makes sense, thanks for the explanation!

The motivating case looks to be "I disabled backtraces in libstd but backtrace-sys is still getting built when checking for standard platforms", specifically in your cross build case. That's good enough for me at least :)

Ah and for conditioning the target string, I thought this was originally motivated by "whenever I build for platform X I want to disable backtraces" which I think is best handled in the code itself, not with more features. That's not the motivation for this, though, so it's all good!

@alexcrichton alexcrichton merged commit e2e23c8 into rust-lang:master Mar 2, 2020
@RalfJung
Copy link
Member Author

RalfJung commented Mar 2, 2020

The motivating case looks to be "I disabled backtraces in libstd but backtrace-sys is still getting built when checking for standard platforms", specifically in your cross build case.

Yes that's a good summary. :)

@RalfJung RalfJung deleted the no-backtrace-sys branch March 2, 2020 21:51
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Mar 14, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 21, 2020
bors bot added a commit to japaric/xargo that referenced this pull request Mar 25, 2020
276: skip copy of windows-gnu libs in check-only mode r=RalfJung a=RalfJung

Unfortunately we cannot test `--target x86_64-pc-windows-gnu` until rust-lang/backtrace-rs#297 lands and propagates. But I confirmed locally that using both together makes that target work on my Linux box.

Co-authored-by: Ralf Jung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Depends on backtrace-sys even when rustc-dep-of-std is the only feature
2 participants