Skip to content

Fix the Linux nightly build by adding a LLVM_CONFIG_<target-triple> dep. #23429

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

Merged
merged 1 commit into from
Mar 17, 2015

Conversation

rprichard
Copy link
Contributor

The RUST_TARGET_STAGE_N rule uses LLVM_LIBDIR_RUSTFLAGS_,
which expands to -L "$(llvm-config --libdir)" when the target-triple is
also a host-triple. Rather than expand to -L "" if llvm-config has not yet
been built, add a dependency on the target llvm-config.

When the target-triple is not a host-triple, the new LLVM_CONFIG_$(2)
dependency should expand to nothing.

r? alexcrichton

@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rprichard
Copy link
Contributor Author

Build #78 succeeded, despite llvm-config not existing:

/bin/sh: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/i686-unknown-linux-gnu/llvm/Release+Asserts/bin/llvm-config: No such file or directory
rustc: x86_64-unknown-linux-gnu/stage1/lib/rustlib/i686-unknown-linux-gnu/lib/libcore
/bin/sh: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/i686-unknown-linux-gnu/llvm/Release+Asserts/bin/llvm-config: No such file or directory
rustc: x86_64-unknown-linux-gnu/stage1/lib/rustlib/i686-unknown-linux-gnu/lib/liblibc
/bin/sh: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/i686-unknown-linux-gnu/llvm/Release+Asserts/bin/llvm-config: No such file or directory
rustc: x86_64-unknown-linux-gnu/stage1/lib/rustlib/i686-unknown-linux-gnu/lib/librand

With the change for #23303, -L "" became an error, so build #79 failed:

/bin/sh: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/i686-unknown-linux-gnu/llvm/Release+Asserts/bin/llvm-config: No such file or directory
rustc: x86_64-unknown-linux-gnu/stage1/lib/rustlib/i686-unknown-linux-gnu/lib/libcore
error: empty search path given via `-L`

The problem is that we're passing LLVM's library directory to all Rust crates, even libcore, which does not actually link against an LLVM library. In certain configurations, libcore is built before LLVM, so llvm-config does not exist yet.

I've only seen the problem with a non-parallel build and --host=i686-unknown-linux-gnu,x86_64-unknown-linux-gnu on a 64-bit Linux machine. I also tried a parallel build and a --target=i686-unknown-linux-gnu build, which did not reproduce the problem. I speculate that the parallel build got lucky and built the non-native LLVM quickly enough, while maybe the single-host build succeeded because LLVM was already an indirect dependency of the Rust crates.

This PR fixes the build failure by ensuring that llvm-config exists if we are going to invoke it.

@rprichard
Copy link
Contributor Author

I hadn't intended to make LLVM_CONFIG_XXX an order-only dependency, but it is one because it's after the | character. Changing llvm-config won't inherently force rebuilding Rust crates. That's... possibly what we want? OTOH, the llvm-config --libdir could change.

I'm inclined to make it a normal dependency instead.

@alexcrichton
Copy link
Member

Yeah I'm fine with a normal dependency as well, thanks for tracking this down!

The RUST_TARGET_STAGE_N rule uses LLVM_LIBDIR_RUSTFLAGS_<target-triple>,
which expands to -L "$(llvm-config --libdir)" when the target-triple is
also a host-triple. Rather than expand to -L "" if llvm-config has not yet
been built, add a dependency on the target llvm-config.

When the target-triple is not a host-triple, the new LLVM_CONFIG_$(2)
dependency should expand to nothing.
@rprichard
Copy link
Contributor Author

Ok, I've changed LLVM_CONFIG_XXX into a normal dependency.

@alexcrichton
Copy link
Member

@bors: r+ b07a1df p=1

@bors
Copy link
Collaborator

bors commented Mar 17, 2015

⌛ Testing commit b07a1df with merge 883551b...

bors added a commit that referenced this pull request Mar 17, 2015
The RUST_TARGET_STAGE_N rule uses LLVM_LIBDIR_RUSTFLAGS_<target-triple>,
which expands to -L "$(llvm-config --libdir)" when the target-triple is
also a host-triple. Rather than expand to -L "" if llvm-config has not yet
been built, add a dependency on the target llvm-config.

When the target-triple is not a host-triple, the new LLVM_CONFIG_$(2)
dependency should expand to nothing.

r? alexcrichton
@bors bors merged commit b07a1df into rust-lang:master Mar 17, 2015
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.

4 participants