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

rustbuild: make backtraces (RUST_BACKTRACE) optional #35051

Merged
merged 2 commits into from
Jul 30, 2016

Conversation

japaric
Copy link
Member

@japaric japaric commented Jul 26, 2016

but keep them enabled by default to maintain the status quo.

When disabled shaves ~56KB off every x86_64-unknown-linux-gnu
binary.

To disable backtraces you have to use a config.toml (see
src/bootstrap/config.toml.example for details) when building rustc/std:

$ python bootstrap.py --config=config.toml


r? @alexcrichton
cc rust-lang/rfcs#1417

but keep them enabled by default to maintain the status quo.

When disabled shaves ~56KB off every x86_64-unknown-linux-gnu
binary.

To disable backtraces you have to use a config.toml (see
src/bootstrap/config.toml.example for details) when building rustc/std:

$ python bootstrap.py --config=config.toml
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@@ -71,6 +73,7 @@ enum Hook {

static HOOK_LOCK: RWLock = RWLock::new();
static mut HOOK: Hook = Hook::Default;
#[cfg(feature = "backtrace")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could some of these imports move down below in the #[cfg]'d block to avoid the number of #[cfg] annotations?

@alexcrichton
Copy link
Member

Thanks @japaric! I think this may also want to update the makefiles as well though to ensure that we compile libstd with --cfg feature="backtrace", right?

@alexcrichton
Copy link
Member

cc @brson

@brson
Copy link
Contributor

brson commented Jul 26, 2016

lgtm

@japaric
Copy link
Member Author

japaric commented Jul 26, 2016

I think this may also want to update the makefiles as well though to ensure that we compile libstd with --cfg feature="backtrace", right?

As implemented, this only works with rustbuild. Want me to extend this to work with the old Makefile based build system? And probably expose this via a configure flag as well?

@alexcrichton
Copy link
Member

Oh I mean in terms of wouldn't a libstd built with the makefiles not have backtraces enabled? (because it's missing the #[cfg])

I'm totally fine not adding this feature to the makefiles, in fact I'd actively prefer that it weren't added to the makefiles!

@japaric
Copy link
Member Author

japaric commented Jul 26, 2016

Oh I mean in terms of wouldn't a libstd built with the makefiles not have backtraces enabled? (because it's missing the #[cfg])

Oh, right. I didn't really test this with the old build system 😈. Can't wait until the old build system is gone so that I don't have to test all my PRs twice!

I think I'll instead change the cfgs to something like any(not(cargobuild), feature = "backtrace") because I'd rather not touch the Makefiles.

@alexcrichton
Copy link
Member

because I'd rather not touch the Makefiles

amen

@japaric
Copy link
Member Author

japaric commented Jul 27, 2016

Updated the PR with the fix for the Makefiles and also reduced the number of cfgs.

@alexcrichton
Copy link
Member

@bors: r+ 774fbdf

Thanks @japaric!

@bors
Copy link
Contributor

bors commented Jul 29, 2016

⌛ Testing commit 774fbdf with merge b1291cf...

@bors
Copy link
Contributor

bors commented Jul 29, 2016

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented Jul 30, 2016

⌛ Testing commit 774fbdf with merge 7580534...

bors added a commit that referenced this pull request Jul 30, 2016
rustbuild: make backtraces (RUST_BACKTRACE) optional

but keep them enabled by default to maintain the status quo.

When disabled shaves ~56KB off every x86_64-unknown-linux-gnu
binary.

To disable backtraces you have to use a config.toml (see
src/bootstrap/config.toml.example for details) when building rustc/std:

$ python bootstrap.py --config=config.toml

---

r? @alexcrichton
cc rust-lang/rfcs#1417
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.

5 participants