Another typical newbie quesiton,
I am on Alpine 3.17(aarch64).
I generated simple project using cargo new demo
, and trying to check what takes time to do cross compile build.
Set RUSTFLAGS as
export RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=lld"
and then ran the command to measure the time passes,
cargo +nightly rustc --bin demo --target x86_64-unknown-linux-gnu -v -- -Z time-passes
I get lots of error like
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
After doing some search, I see that I need to set --sysroot
.
Some typical newbie questions
- It is possible to cross compile
gnu
multi arch from arm64 --> x86_64 ? - If #1 is doable then do I need to add
--sysroot
the is it possible to set viaRUSTFLAG
that typically loads the right symbols? - Using
clang
linker withlld
is recommended to improve the compile time ?