hyousef
1
I'm trying to build for RPi from Mac,
Started by:
$ rustup target add armv7-unknown-linux-gnueabihf
Creating file .cargo/config
with content:
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
And running the:
$ cargo build --target armv7-unknown-linux-gnueabihf
But I got the below error:
error: linker `arm-linux-gnueabihf-gcc` not found
|
= note: No such file or directory (os error 2)
Tried the below after that, but nothing worked:
$ brew install arm-linux-gnueabihf-binutils
$ brew tap osx-cross/arm
$ brew install arm-gcc-bin
$ brew install llvm
But everytime I run:
$ which gcc-arm-linux-gnueabi
I get nothing, and keep getting the same error above.
I tried using musleabihf
as alternate gnueabihf
, but the generated binary failed to work at RPi
[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-ld"
I'd a look at this as well, but nothing about MacOS
hyousef
2
It looks I made copy of wrong binary in while testing the musleabihf
it is working in real, as bellow:
$ brew install arm-linux-gnueabihf-binutils
$ rustup target add armv7-unknown-linux-musleabihf
In .cargo/config
[build]
target = "armv7-unknown-linux-musleabihf"
[target.armv7-unknown-linux-c]
linker = "arm-linux-gnueabihf-ld"
With simple src/main.rs
fn main() {
println!("Hello, Raspberry!");
}
Then things are fine:
Hasans-Air:rpi hasan$ cargo build
Compiling rpi v0.1.0 (/Users/hasan/PycharmProjects/rpi)
Finished dev [unoptimized + debuginfo] target(s) in 0.41s
Hasans-Air:rpi hasan$ scp target/armv7-unknown-linux-musleabihf/debug/rpi pi@192.168.1.43:
pi@192.168.1.43's password:
rpi 100% 2702KB 2.6MB/s 00:01
Hasans-Air:rpi hasan$ ssh pi@192.168.1.43 'chmod +x ~/rpi && ~/rpi'
pi@192.168.1.43's password:
Hello, Raspberry!
For Win 10
I was able to get the linker from here, and run:
rustup target add armv7-unknown-linux-gnueabihf
Creating file .cargo/config
with content:
[build]
target = "armv7-unknown-linux-gnueabihf"
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
And with simple src/main.rs
:
fn main() {
println!("Hello, Raspberry! from Win 10");
}
I was able to get things done
3 Likes
system
Closed
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.