Linking `sparc64-unknown-netbsd` error `relocation R_SPARC_64 cannot be used against local symbol`
Open
Nobody has claimed this yet.
A-linkage
needs-triage
requires-nightly
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
cross compile to sparc64-unknown-netbsd using clang+lld with -Zbuild-std on nightly got error as below:
error: linking with `clang` failed: exit status: 1
│
├ note: "clang" "-Wl,--dynamic-list" "-Wl,/home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/rustcN0RvSA/list" "-m64" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/compiler_builtins/411d30a812e427e7/deps/libcompiler_builtins-411d30a812e427e7.rlib" "-Wl,-Bdynamic" "-lutil" "-lrt" "-lutil" "-lexecinfo" "-lexecinfo" "-lpthread" "-lrt" "-lgcc_s" "-lutil" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lrt" "-lutil" "-lexecinfo" "-L" "/home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/rustcN0RvSA/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-o" "/home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-all" "-Wl,--enable-new-dtags,-z,origin" "--sysroot=sysroot/netbsd/sparc64" "--target=sparc64--netbsd" "-fuse-ld=lld
├ note: some arguments are omitted. use `--verbose` to show all linker arguments
╰ note: ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(.Lanon.4a5e89f32eda266736fb166193fda49d.18)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(Img::H2JhoLwaFfmd)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(Img::H2JhoLwaFfmd)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(Img::H2JhoLwaFfmd)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(.Lanon.4a5e89f32eda266736fb166193fda49d.51)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(.Lanon.4a5e89f32eda266736fb166193fda49d.51)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(.Lanon.4a5e89f32eda266736fb166193fda49d.51)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(Img::H5GgwjsiiiM5)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(.Lanon.4a5e89f32eda266736fb166193fda49d.87)
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o
>>> referenced by Img.bd80e59a0a54a641-cgu.0
>>> /home/runner/work/Img/Img/build-dir/sparc64-unknown-netbsd/src/build/Img/f554400d1d2d890d/deps/Img.Img.bd80e59a0a54a641-cgu.0.rcgu.o:(.Lanon.4a5e89f32eda266736fb166193fda49d.87)
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
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 reproducing the nightly cross-compilation to sparc64-unknown-netbsd with clang+lld and -Zbuild-std, then inspect the verbose linker invocation and the R_SPARC_64 diagnostics. The report names no repository files or tests; done means identifying the responsible compiler or linker component and confirming a successful link or a precisely documented diagnosis.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100