How to cross compile M2 Macbook pro to Raspberry Pi 4

How to cross compile M2 Macbook pro to Rpi 4 (raspbian official OS) with paho-mqtt dependency?

Cargo.toml

[dependencies]
axum = { version = "^0.7.5", features = ["ws"] }
futures = "^0.3.30"
paho-mqtt = { version = "^0.12.5", features = ["vendored-ssl"] }
serde = { version = "^1.0.210", features = ["derive"] }
serde_json = "^1.0.128"
serialport = "^4.5.0"
sysinfo = "^0.31.4"
tokio = { version = "^1.40.0", features = ["full"] }
tower-http = { version = "^0.5.2", features = ["full"] }
tracing = "^0.1.40"
tracing-subscriber = "^0.3.18"

.cargo/config.toml

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-binutils"

Build command
cargo build --release --target armv7-unknown-linux-gnueabihf

Error

error: failed to run custom build command for `zstd-sys v2.0.10+zstd.1.5.6`

--- stderr
error occurred: Failed to find tool. Is `arm-linux-gnueabihf-gcc` installed?

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `libudev-sys v0.1.4`

warning: openssl-sys@0.9.102: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `arm-linux-gnueabihf-gcc` installed?
error: failed to run custom build command for `openssl-sys v0.9.102`

Thanks

I have had a good experience with cross

Thanks. I tried but getting similar errors

Did you install the tool the build script is looking for?

Yes but no luck :smiling_face_with_tear:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.