`rustup component add llvm-bitcode-linker` should imply `rustup component add llvm-tools`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
rustup component add llvm-bitcode-linker should imply rustup component add llvm-tools. If llvm-bitcode-linker is installed but llvm-tools is not installed, linking with llvm-bitcode-linker causes confusing errors since it tries to use system llvm.
confusing errors
error: linking with `llvm-bitcode-linker` failed: exit status: 1
|
= note: "llvm-bitcode-linker" "<1 object files omitted>" "<sysroot>/lib/rustlib/nvptx64-nvidia-cuda/lib/{librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-L" "/tmp/rustcnJ2SL2/raw-dylibs" "--target" "nvptx64-nvidia-cuda" "--target-cpu" "sm_30" "-L" "<sysroot>/lib/rustlib/nvptx64-nvidia-cuda/lib/self-contained" "-o" "/usamoi/playground/ru/target/nvptx64-nvidia-cuda/debug/deps/ru-f4c0ba032d0d0a83.ptx" "-O0" "--debug"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: Error: llvm-link failed to link files ["/usamoi/playground/ru/target/nvptx64-nvidia-cuda/debug/deps/ru-f4c0ba032d0d0a83.aiqzghoh0fmgtru173eaewpev.rcgu.o", "/home/usamoi/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/nvptx64-nvidia-cuda/lib/librustc_std_workspace_core-3fd0694f720b1c16.rlib", "/home/usamoi/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/nvptx64-nvidia-cuda/lib/libcore-4a9eff19b785368f.rlib", "/home/usamoi/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/nvptx64-nvidia-cuda/lib/libcompiler_builtins-4240302f1379e85f.rlib"]
␛[2m2025-03-26T11:10:55.850207Z␛[0m ␛[32m INFO␛[0m ␛[2mllvm_bitcode_linker::linker␛[0m␛[2m:␛[0m Linking 4 files using llvm-link
␛[2m2025-03-26T11:10:55.861321Z␛[0m ␛[31mERROR␛[0m ␛[2mllvm_bitcode_linker::linker␛[0m␛[2m:␛[0m llvm-link returned with Exit status: exit status: 1
stdout:
stderr: error: Invalid record
reproduce
-
cargo init -
src/main.rs
#![no_std]
#![no_main]
#[panic_handler]
fn panic_handler(_: &core::panic::PanicInfo<'_>) -> ! {
loop {}
}
rustup-toolchain
nightly
-
rustup component remove llvm-tools -
rustup component add llvm-bitcode-linker -
RUSTFLAGS="-Clinker=llvm-bitcode-linker" cargo build --target nvptx64-nvidia-cuda
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the rustup component add and rustup component remove behavior described in the reproduction, using rustup-toolchain and the llvm-bitcode-linker component as entry points. Reproduce the build from src/main.rs with cargo build --target nvptx64-nvidia-cuda; done means adding llvm-bitcode-linker also makes the linker use the required LLVM tools and avoids the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100