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

Shipping llvm-strip w/ a symlink breaks when bootstrap compiler doesn't contain any LLVM tools #132719

Closed
jieyouxu opened this issue Nov 7, 2024 · 3 comments · Fixed by #132720
Assignees
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jieyouxu
Copy link
Member

jieyouxu commented Nov 7, 2024

This breaks bootstrapping when the bootstrap compiler doesn't contain any LLVM tools as is the case when cg_clif bootstraps rustc:

Building stage0 tool lld-wrapper (x86_64-unknown-linux-gnu)
     Compiling lld-wrapper v0.1.0 (/home/runner/work/rustc_codegen_cranelift/rustc_codegen_cranelift/rust/src/tools/lld-wrapper)
      Finished `release` profile [optimized] target(s) in 0.43s
  thread 'main' panicked at src/lib.rs:1714:24:
src.symlink_metadata() failed with No such file or directory (os error 2) ("src = /home/runner/work/rustc_codegen_cranelift/rustc_codegen_cranelift/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objcopy")

It should probably check builder.config.llvm_enabled(target_compiler.host) && builder.config.llvm_tools_enabled before copying to ensure that llvm-objcopy exists in the first place.

Originally posted by @bjorn3 in #131405 (comment)

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 7, 2024
@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 7, 2024
@jieyouxu jieyouxu self-assigned this Nov 7, 2024
@bjorn3
Copy link
Member

bjorn3 commented Nov 7, 2024

Worked around this in rust-lang/rustc_codegen_cranelift@b5966e4e.

@jieyouxu
Copy link
Member Author

jieyouxu commented Nov 7, 2024

PR: #132720

@hoodmane
Copy link
Contributor

hoodmane commented Nov 11, 2024

I'm also hitting this. Can confirm that #132720 fixes the problem.

@bors bors closed this as completed in de27914 Nov 11, 2024
mati865 pushed a commit to mati865/rust that referenced this issue Nov 12, 2024
Only copy, rename and link `llvm-objcopy` if llvm tools are enabled

Fixes rust-lang#132719.

cc `@bjorn3` who reported the bootstrapping problem for cg_clif.
cc `@davidtwco` in case this might be problematic for linux -> macOS cross-compile builds, but seems very unlikely.
cc `@albertlarsan68` (co-reviewed rust-lang#131405)

r? bootstrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants