I have used Rust for a period, and I have basic knowledge about Rust, but I still don't have a no idea how to cross compile, I think cross-compile is not as easy as I thought.
Problem1: I usually worked on aarch64 linux, I have tried compile my code to x86_64-unknown-linux-musl
by added its target by rustup and modified .cargo/config
like follows, and everything goes well.
[target.x86_64-unknown-linux-musl]
linker="lld"
Then I tried compile to aarch64-unknown-linux-gnu
which is my host but modified the config
additionally like this:
[target.aarch64-unknown-linux-gnu]
linker="lld"
But it didn't worked as expectation this time.
...A dozen of command...
= note: lld: error: unable to find library -lgcc_s
lld: error: unable to find library -lutil
lld: error: unable to find library -lrt
lld: error: unable to find library -lpthread
lld: error: unable to find library -lm
lld: error: unable to find library -ldl
lld: error: unable to find library -lc
error: aborting due to previous error; 9 warnings emitted
error: could not compile `mcmu`
To learn more, run the command again with --verbose.
Then I tried to compile to x86_64-pc-windows-gnu
as above did, but it also printed similar errors.
Why can I compile to x86 Linux but cannot compile to aarch64 Linux and windows even aarch64 Linux is my device's host? Am I have nothing to do except installing linkers for every platform?
Problem2:
If not, does it possible to install these missing library? How to do it? I have searched on the Internet for a long time but in vain.
Is there anybody can help me? Thanks!