Problem
Can't link target riscv64gc-unknown-linux-gnu on linux, im experimenting with riscv
and I thought that it would be easy to make a hello world and compile it directly but... linker issues!
Since I've experienced something similar before I tried some solutions but none with success.
Tries
This sould work out of the box
-> rustc main.rs --target=riscv64gc-unknown-linux-gnu main.rs
🔴 linking with 'cc' failed: exit code: 1
Telling it to use llvm? (use to fix this kind of issue)
-> rustc main.rs --target=riscv64gc-unknown-linux-gnu -C linker-flavor=ld.lld main.rs
🔴 linking with 'lld' failed: exit code: 1 ...
lld: error: unable to find library: -lgcc_s -lutil -lrt -lpthread -lm -ldl -lc
Maybe with the riscv linker...
-> rustc --target=riscv64gc-unknown-linux-gnu -C linker=/opt/riscv/bin/riscv64-unknown-elf-ld main.rs
🔴 argument -pie not supported
Any solutions to this?
Notes
Output of rustup --version:
rustup 1.23.1 (3df2264a9 2020-11-30)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active 'rustc' version is 'rustc 1.52.0-nightly (45b3c2851 2021-03-04)'
Output of rustup show:
Default host: x86_64-unknown-linux-gnu
rustup home: /home/elgusanito/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (default)
nightly-2020-07-27-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
installed targets for active toolchain
--------------------------------------
riscv32imac-unknown-none-elf
riscv64gc-unknown-linux-gnu
riscv64gc-unknown-none-elf
x86_64-unknown-linux-gnu
active toolchain
----------------
nightly-x86_64-unknown-linux-gnu (directory override for '/home/elgusanito/rust/riscky-whooshky-fivesky')
Problem
Can't link target riscv64gc-unknown-linux-gnu on linux, im experimenting with riscv
and I thought that it would be easy to make a hello world and compile it directly but... linker issues!
Since I've experienced something similar before I tried some solutions but none with success.
Tries
This sould work out of the box
->
rustc main.rs --target=riscv64gc-unknown-linux-gnu main.rs🔴
linking with 'cc' failed: exit code: 1Telling it to use llvm? (use to fix this kind of issue)
->
rustc main.rs --target=riscv64gc-unknown-linux-gnu -C linker-flavor=ld.lld main.rs🔴
linking with 'lld' failed: exit code: 1...lld: error: unable to find library: -lgcc_s -lutil -lrt -lpthread -lm -ldl -lcMaybe with the riscv linker...
->
rustc --target=riscv64gc-unknown-linux-gnu -C linker=/opt/riscv/bin/riscv64-unknown-elf-ld main.rs🔴
argument -pie not supportedAny solutions to this?
Notes
Output of
rustup --version:Output of
rustup show: