rust-lang / rust-lang/rust

Wrong rust-lld used for target riscv64gc-unknown-linux-gnu

Open
#152,098 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage O-riscv
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: /tmp/rustccLx4WH/symbols.o is incompatible with elf64-x86-64
          rust-lld: error: /root/github/rusty-rain/target/riscv64gc-unknown-linux-gnu/release/deps/rusty_rain-f9cdb814e0fff0bf.rusty_rain.d9a7a1be04eb8039-cgu.00.rcgu.o is incompatible with elf64-x86-64

I think it's an evident fact according to the log above.

And I've tried to use a custom linker but failed.

[target.riscv64gc-unknown-linux-gnu]
cc = "riscv64-linux-gnu-gcc"
cxx = "riscv64-linux-gnu-g++"
ar = "riscv64-linux-gnu-ar"
ranlib = "riscv64-linux-gnu-ranlib"
linker = "riscv64-linux-gnu-gcc"

[env]
CC_riscv64gc-unknown-linux-gnu="riscv64-linux-gnu-gcc"
CXX_riscv64gc-unknown-linux-gnu="riscv64-linux-gnu-g++"
AR_riscv64gc-unknown-linux-gnu="riscv64-linux-gnu-ar"
RANLIB_riscv64gc-unknown-linux-gnu="riscv64-linux-gnu-ranlib"
LINKER_riscv64gc-unknown-linux-gnu="riscv64-linux-gnu-gcc"
error: expected a table, but found a string for `target.riscv64gc-unknown-linux-gnu.ranlib` in /root/github/rusty-rain/.cargo/config.toml

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported .cargo/config.toml target.riscv64gc-unknown-linux-gnu table and reproduce the build with Cargo's verbose linker arguments. Investigate why rust-lld is selected despite the configured linker and why the ranlib value is parsed as a string. Done means the target build selects a compatible RISC-V linker without the reported ELF incompatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.