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

error: unable to run rust-objcopy: No such file or directory (os error 2) #135472

Closed
onur-ozkan opened this issue Jan 14, 2025 · 3 comments
Closed
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@onur-ozkan
Copy link
Member

As we install rust-objcopy conditionally on dist step

if builder.config.llvm_enabled(compiler.host) && builder.config.llvm_tools_enabled {
let src_dir = builder.sysroot_target_bindir(compiler, host);
let llvm_objcopy = exe("llvm-objcopy", compiler.host);
let rust_objcopy = exe("rust-objcopy", compiler.host);
builder.copy_link(&src_dir.join(&llvm_objcopy), &dst_dir.join(&rust_objcopy));
}

using external LLVM with llvm-tools set to false causes the toolchain built from bootstrap to fail when compiling programs due to the missing rust-objcopy.

We should be capable of checking for the external LLVM's tools and installing them. If these tools don't exist, the build should terminate (so it doesn't waste hours of time on building) with an error message.

@onur-ozkan onur-ozkan added C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jan 14, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 14, 2025
@onur-ozkan onur-ozkan removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 14, 2025
@onur-ozkan
Copy link
Member Author

Turns out this isn't the case.. See #135356 (comment).

@onur-ozkan onur-ozkan closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2025
@debohman
Copy link

As I commented in #135356, setting llvm-tools=true when building with a system LLVM does not install rust-objcopy into the destination root.

@onur-ozkan
Copy link
Member Author

I tried it multiple times and it worked fine on each try.

[llvm]
download-ci-llvm=false

[rust]
download-rustc = false
llvm-tools = true

[target.x86_64-unknown-linux-gnu]
llvm-config = "/home/nimda/devspace/llvm-19/bin/llvm-config"

I invoked DESTDIR=./demo ./x.py install command on 1.84.0 stable tarball source using the config above, here is the result:

$ ~/downloads/rustc-1.84.0-src  $ ls -lah ./demo/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/bin
total 6.7M
drwxr-xr-x 2 nimda nimda 4.0K Jan 16 15:38 .
drwxr-xr-x 4 nimda nimda 4.0K Jan 16 15:38 ..
-rwxr-xr-x 1 nimda nimda 6.7M Jan 16 15:38 rust-objcopy

rust-objcopy is installed from the external LLVM (which is /home/nimda/devspace/llvm-19) as expected.

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)
Projects
None yet
Development

No branches or pull requests

3 participants