using rust for a while, and I just got myself some few orangepi devices lately..
I am trying to compile from windows10 machine(MINGW64_NT-10.0) a simple hello world and try to run it in a aarch64 system(and hopefully other devices too like omega 2+). it works obviously in cargo run but when I try cargo build --target aarch64-unknown-linux-gnu it doesn't work..
here is the complete the complete command and error.
$ cargo build --target aarch64-unknown-linux-gnu --release
Compiling hello v0.1.0 (file:///D:/Developer/rust/hello)
error: linker `aarch64-buildroot-linux-gnu-gcc` not found
|
= note: The system cannot find the file specified. (os error 2)
error: aborting due to previous error
error: Could not compile `hello`.
To learn more, run the command again with --verbose.
I have looked other tutorials and steps, but can't get it correct. I will post some information on my system..
// toolchain list
$ rustup toolchain list
stable-aarch64-unknown-linux-gnu
stable-mipsel-unknown-linux-gnu
stable-x86_64-pc-windows-msvc
nightly-aarch64-unknown-linux-gnu
nightly-mipsel-unknown-linux-gnu
nightly-x86_64-pc-windows-msvc (default)
// rustup version
$ rustup --version
rustup 1.13.0 (ea9259c1b 2018-07-16)
// cargo version
$ cargo version
cargo 1.29.0-nightly (0ec7281b9 2018-08-20)
// .cargo/config
$ cat ~/.cargo/config
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-buildroot-linux-gnu-gcc"
thank you for the response.. but I don't think this will work, as it is the same steps that I am following, and the last part apt-get install will not work as I am using windows w/o subsystem..
Rust doesn't know how to make executables, and relies on the linker to do it for it. So you have to find and install a cross-linker and Linux system libraries yourself.
The linker path in ~/.cargo/config is not part of Rust. It has to point to actual name of the Linux-compatible linker you find and install on your machine.
Afaik lld, the linker from LLVM, is shipped with rust now, so you can use that to link it. I'm not quiet sure how to do it though. You may need to crawl through a few github posts or this reddit post.
If you had success, we would like to hear your story!
hey guys, I just gotten home and setting up another windows machine.. and I am following the above link. now the error has changed.
$ cargo build --target=aarch64-unknown-linux-gnu
Compiling hello_arm v0.1.0 (D:\Developer\rust\hello_arm)
error: linker `lld` not found
|
= note: The system cannot find the file specified. (os error 2)
error: aborting due to previous error
error: Could not compile `hello_arm`.
To learn more, run the command again with --verbose.
I know I can finish this in linux/mac, as there are lots of tutorials. but I am windows now, with so much cores that made my switch..