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

Unable to build hello world with Xargo (can't perform LTO when compiling incrementally) #236

Closed
johnthagen opened this issue Jan 30, 2019 · 5 comments

Comments

@johnthagen
Copy link
Contributor

johnthagen commented Jan 30, 2019

Follow the instructions here to build the hello world xargo subproject.

On Mac:

$ xargo build --target x86_64-apple-darwin --release --verbose
+ "rustc" "--print" "sysroot"
+ RUSTFLAGS="--sysroot /Users/user/.xargo/HOST"
+ "cargo" "build" "--target" "x86_64-apple-darwin" "--release" "--verbose"
   Compiling min-sized-rust-xargo v0.1.0 (/Users/user/GitHub/min-sized-rust/xargo)
     Running `rustc --edition=2018 --crate-name min_sized_rust_xargo src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=z -C panic=abort -C lto -C codegen-units=1 -C metadata=2a6dbeac17463644 -C extra-filename=-2a6dbeac17463644 --out-dir /Users/user/GitHub/min-sized-rust/xargo/target/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -C incremental=/Users/user/GitHub/min-sized-rust/xargo/target/x86_64-apple-darwin/release/incremental -L dependency=/Users/user/GitHub/min-sized-rust/xargo/target/x86_64-apple-darwin/release/deps -L dependency=/Users/user/GitHub/min-sized-rust/xargo/target/release/deps --sysroot /Users/user/.xargo/HOST`
error: can't perform LTO when compiling incrementally

error: aborting due to previous error

error: Could not compile `min-sized-rust-xargo`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name min_sized_rust_xargo src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=z -C panic=abort -C lto -C codegen-units=1 -C metadata=2a6dbeac17463644 -C extra-filename=-2a6dbeac17463644 --out-dir /Users/user/GitHub/min-sized-rust/xargo/target/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -C incremental=/Users/user/GitHub/min-sized-rust/xargo/target/x86_64-apple-darwin/release/incremental -L dependency=/Users/user/GitHub/min-sized-rust/xargo/target/x86_64-apple-darwin/release/deps -L dependency=/Users/user/GitHub/min-sized-rust/xargo/target/release/deps --sysroot /Users/user/.xargo/HOST` (exit code: 1)

What's strange is that this is after a xargo clean, so it shouldn't be an incremental build?

For a failed Linux build output see: https://travis-ci.org/johnthagen/min-sized-rust/jobs/486629156

Cargo.toml:

[package]
name = "min-sized-rust-xargo"
version = "0.1.0"
authors = ["johnthagen <johnthagen@gmail.com>"]
edition = "2018"

[dependencies]

[profile.release]
opt-level = 'z'     # Optimize for size.
lto = true          # Enable Link Time Optimization
codegen-units = 1   # Reduce number of codegen units to increase optimizations.
panic = 'abort'     # Abort on panic

Xargo.toml:

[dependencies]
std = {default-features=false}
@johnthagen
Copy link
Contributor Author

johnthagen commented Jan 30, 2019

Bisecting nightly versions, this problem started appearing with nightly-2019-01-28 (for macOS).

Though, it seems like Linux with versions before that are still failing: https://travis-ci.org/johnthagen/min-sized-rust/jobs/486680281

@phil-opp
Copy link

This is a bug in cargo that should be fixed in the current or upcoming nightly. It was reported in rust-lang/cargo#6564 (comment) and fixed in rust-lang/cargo#6610.

@johnthagen
Copy link
Contributor Author

I'm still hitting this issue with rustc 1.34.0-nightly (8ae730a44 2019-02-04).

@phil-opp
Copy link

phil-opp commented Feb 5, 2019

That's because cargo is a git submodule in the rustc repo which still uses the 9 day old commit 245818076 for cargo. You can see this when you run cargo --version.

There is an open PR that updates the cargo submodule, which should finally fix this issue: rust-lang/rust#58131.

@johnthagen
Copy link
Contributor Author

This has been fixed on the latest nightlies.

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

No branches or pull requests

2 participants