-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Turn off debuginfo for build dependencies to improve compile times #10493
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
36315df
change build-dependencies defaults for faster compile times
lqd 8d8448c
update `compiler_json_error_format` test for new build-deps defaults
lqd b160046
update `build_cmd_with_a_build_cmd` test for new build-deps defaults
lqd 8ab2c69
update tests relying on dev and build-deps reuse
lqd 596ae96
update `reuse_panic_pm` test for new build-deps defaults
lqd e55a70d
update `named_config_profile` test for new build-deps defaults
lqd 86cba71
update `profile_targets` tests for new build-deps defaults
lqd e586544
update build dependencies profiles documentation
lqd 835978b
display note to increase debuginfo level when build deps fail
lqd d5f1078
add build script failure test when requesting backtraces
lqd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,43 @@ Caused by: | |
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn custom_build_script_failed_backtraces_message() { | ||
// debuginfo is turned off by default in `dev.build-override`. However, | ||
// if an error occurs running e.g. a build script, a message explaining | ||
// how to improve backtraces is also displayed. | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[project] | ||
|
||
name = "foo" | ||
version = "0.5.0" | ||
authors = ["[email protected]"] | ||
build = "build.rs" | ||
"#, | ||
) | ||
.file("src/main.rs", "fn main() {}") | ||
.file("build.rs", "fn main() { std::process::exit(101); }") | ||
.build(); | ||
p.cargo("build -v") | ||
.env("RUST_BACKTRACE", "1") | ||
.with_status(101) | ||
.with_stderr( | ||
"\ | ||
[COMPILING] foo v0.5.0 ([CWD]) | ||
[RUNNING] `rustc --crate-name build_script_build build.rs [..]--crate-type bin [..]` | ||
[RUNNING] `[..]/build-script-build` | ||
[ERROR] failed to run custom build command for `foo v0.5.0 ([CWD])` | ||
note: To improve backtraces for build dependencies[..] | ||
|
||
Caused by: | ||
process didn't exit successfully: `[..]/build-script-build` (exit [..]: 101)", | ||
) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn custom_build_env_vars() { | ||
let p = project() | ||
|
@@ -1629,14 +1666,14 @@ fn build_cmd_with_a_build_cmd() { | |
[RUNNING] `rustc [..] a/build.rs [..] --extern b=[..]` | ||
[RUNNING] `[..]/a-[..]/build-script-build` | ||
[RUNNING] `rustc --crate-name a [..]lib.rs [..]--crate-type lib \ | ||
--emit=[..]link[..]-C debuginfo=2 \ | ||
--emit=[..]link[..] \ | ||
-C metadata=[..] \ | ||
--out-dir [..]target/debug/deps \ | ||
-L [..]target/debug/deps` | ||
[COMPILING] foo v0.5.0 ([CWD]) | ||
[RUNNING] `rustc --crate-name build_script_build build.rs [..]--crate-type bin \ | ||
--emit=[..]link[..]\ | ||
-C debuginfo=2 -C metadata=[..] --out-dir [..] \ | ||
-C metadata=[..] --out-dir [..] \ | ||
-L [..]target/debug/deps \ | ||
--extern a=[..]liba[..].rlib` | ||
[RUNNING] `[..]/foo-[..]/build-script-build` | ||
|
@@ -4379,6 +4416,10 @@ fn optional_build_script_dep() { | |
|
||
#[cargo_test] | ||
fn optional_build_dep_and_required_normal_dep() { | ||
// Note: `dev` and `dev.build-override` have different defaults. `bar` would | ||
// be built twice in the general case: once without debuginfo and once with | ||
// debuginfo = 2. Setting `debug = 2` in `dev.build-override` ensures it's | ||
// only built once in this test. | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
|
@@ -4393,6 +4434,9 @@ fn optional_build_dep_and_required_normal_dep() { | |
|
||
[build-dependencies] | ||
bar = { path = "./bar" } | ||
|
||
[profile.dev.build-override] | ||
debug = 2 # see note above | ||
"#, | ||
) | ||
.file("build.rs", "extern crate bar; fn main() { bar::bar(); }") | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also add
strip = "debuginfo"
on all platforms but macOS?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the cargo team asked not to have
strip
for now in this message.(incidentally, a friend tried the defaults I suggested and his project saw weird errors about unstable -Z flags being used on a stable compiler, because of stripping on android, so I'm not sure that all targets can use it rn)