Thanks all of your helps guys :slight_smile: Finally I find out the problems between my brew downloaded rust and rustup update version. The rustc version had error to read other toolchanins. So I uninstalled rust by using "brew uninstall rust" and reinstall from the official site. And it work!! Th… Answer from js02sh on users.rust-lang.org
🌐
Sebastian Aigner
sebi.io › posts › 2024-05-02-guide-cross-compiling-rust-from-macos-to-raspberry-pi-2024-apple-silicon
Guide: Cross-compiling Rust from macOS to Raspberry Pi (2024, Apple Silicon) | Sebastian Aigner
May 2, 2024 - reqwest = { version = "0.11.23", features = ["json", "rustls"], default-features = false } Enjoy building some oxidized binaries for your Raspberry!
Discussions

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 ... More on users.rust-lang.org
🌐 users.rust-lang.org
0
0
September 9, 2024
Cross-compiling from MacOS to the Raspberry Pi
I decided to start writing articles about the projects I work on, so here’s the first blog post I’ve ever done! Criticism is welcome (constructive, preferably). Thanks! More on reddit.com
🌐 r/rust
6
12
June 4, 2020
Cross-compiling from macOS to ARM
Trying to cross-compile from Mac to a raspberry pi zero W which runs ARMv6. Edit: Now the compiling issue is with openssl. If anyone knows how to get compiling openssl working, that'd be awesome. Original: I've set up my .cargo/config as the following [target.arm-unknown-linux-musleabihf] linker ... More on users.rust-lang.org
🌐 users.rust-lang.org
0
1
February 24, 2021
Cross-compiling Rust for the Raspberry Pi on macOS
I look forward to the day when steed and rustls are mature and we no longer need to do anything more than rustup target add $target and cargo build --target $target. This is one area where Go currently blows Rust out of the water, cause Go programs rarely rely on libc or OpenSSL. More on reddit.com
🌐 r/rust
6
42
November 7, 2017
🌐
T-shaped
t-shaped.nl › 2020 › cross-compiling-rust-programs-for-a-raspberry-pi-from-macos
Cross-compiling Rust programs for a Raspberry Pi from macOS • T-shaped
Then, call cargo build with the musl binaries in the path: PATH=$PATH:/Users/yourname/musl/arm-linux-musleabi-cross/bin cargo build --target=arm-unknown-linux-musleabi. Note that you could theoretically replace ‘arm’ with ‘armhf’, ‘armel’, ‘armv7’, ‘aarch64’ to build code that is faster on newer Pi models. As far as I know however the standard ‘arm’ code runs fine on all Pi’s (except perhaps the Pi 4 which is 64 bit ARM or AArch64).
🌐
Rust Programming Language
users.rust-lang.org › help
How to cross compile M2 Macbook pro to Raspberry Pi 4 - help - The Rust Programming Language Forum
September 9, 2024 - 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 ...
🌐
Amrit Rathie
amritrathie.vercel.app › posts › 2020 › 03 › 06 › cross-compiling-rust-from-macos-to-raspberry-pi
Cross-compiling Rust from MacOS to Raspberry Pi :: Amrit Rathie — Software Developer
March 6, 2020 - A good shortcut for this when building for the machine you’re writing the code on is specifying RUSTFLAGS="-C target-cpu=native". This won’t work for us, however, because we’re cross-compiling. If we want platform specific optimizations for our program, we need to specify the target-cpu ...
🌐
Reddit
reddit.com › r/rust › cross-compiling from macos to the raspberry pi
r/rust on Reddit: Cross-compiling from MacOS to the Raspberry Pi
June 4, 2020 - that said, there’s nothing wrong with using docker (besides the extra disk space it needs and extra work needed to reclaim storage). there’s no one right way to cross-compile. this was just the way i did it, and i hope it helps other people find a way that works for them. thank you for your input though, it’s exactly the kind i’m looking for, and is very much appreciated :) ... Actually, docker is very easy to install on macos.
🌐
Rust Programming Language
users.rust-lang.org › help
Cross-compiling from macOS to ARM - help - The Rust Programming Language Forum
February 24, 2021 - Trying to cross-compile from Mac to a raspberry pi zero W which runs ARMv6. Edit: Now the compiling issue is with openssl. If anyone knows how to get compiling openssl working, that'd be awesome. Original: I've set up my .cargo/config as the following [target.arm-unknown-linux-musleabihf] linker ...
🌐
Reddit
reddit.com › r/rust › cross-compiling rust for the raspberry pi on macos
r/rust on Reddit: Cross-compiling Rust for the Raspberry Pi on macOS
November 7, 2017 - Nice! Tried that from Linux and I could not make it work. Then I found rust-cross: https://github.com/japaric/rust-cross Have you checked this?
Find elsewhere
🌐
fabian writes.
capnfabs.net › posts › cross-compiling-rust-apps-raspberry-pi
Cross-Compiling Rust apps for the Raspberry Pi || fabian writes.
October 22, 2020 - Now, we can theoretically tell the Ubuntu install on the Docker container to “enable the Raspberry Pi architecture (armhf) and install the required packages”: # Use the container that comes with `cross` as a base. It's already got # a cross-compile toolchain installed, so that's less work for us. FROM rustembedded/cross:armv7-unknown-linux-gnueabihf-0.2.1 RUN apt-get update RUN dpkg --add-architecture armhf && \ apt-get update && \ apt-get install --assume-yes libssl-dev:armhf libasound2-dev:armhf
🌐
Exceptional Mirrors
mirrors.link › posts › cross-compiling-rust-on-os-x-for-raspberry-pi-3
Cross compiling Rust on OS X for Raspberry Pi 3 · Exceptional Mirrors
March 8, 2016 - I ran into problems with permissions in Docker, but after some digging I found the post called “Web development with Docker on Mac OS X”. The user created inside the Docker image needs to have uid set to 1000 to access files from the host filesystem. The PR which fixes this has been already merged into the rust-on-raspberry-pi master branch. It took me a couple of days, but cross compiling finally works on my machine and the compiled programs seem to run well on Raspi.
🌐
DEV Community
dev.to › h_ajsf › cross-compiling-rust-for-raspberry-pi-4iai
Cross compiling Rust for Raspberry Pi - DEV Community
September 11, 2019 - For MacOS better use: musleabihf as target, and for Windows you can use gnueabihf as bellow: ... [build] target = "armv7-unknown-linux-musleabihf" [target.armv7-unknown-linux-c] linker = "arm-linux-gnueabihf-ld" ...
🌐
Medium
medium.com › swlh › compiling-rust-for-raspberry-pi-arm-922b55dbb050
Compile Rust for Raspberry Pi ARM | by Tiziano Santoro | The Startup | Medium
October 17, 2020 - In this article we will build a simple HTTP server application in Rust, cross-compile it for the Raspberry Pi ARM architecture, deploy it to a Raspberry Pi board over a network connection, and install it as a persistent service so that it restarts automatically at boot time and upon crash. For the rest of the article, there will be two devices involved: a development machine, for instance a Linux or Mac laptop or desktop computer, from which we do most of the development.
🌐
Reddit
reddit.com › r/rust › what steps are needed to cross-compile a program that runs on my raspberry pi zero 2 w?
r/rust on Reddit: What steps are needed to cross-compile a program that runs on my raspberry pi zero 2 w?
July 6, 2024 -

Hi, I already succeeded partially in this as I compiled a rust program for my raspberry pi zero w (the first version). Let's call that one rp0w1 and the new version rp0w2 for clarity.
On my rp0w1 I run rasberry pi os, because that's the only OS supported. I oriented myself on this blog post: link
On the rp0w2 I am running arch linux (arm) though, because I prefer it. And the toolchain isn't correct (the one also mentioned in the blog post).

I would like to know what steps would be needed in order to get a binary that I can run on my rp0w2. I am also not entirely sure what toolchain means in this context. I already have a toolchain installed through rustup don't I? Why do I need additional files?

Can I simply download some files from ARM or what do I do?

🌐
Growse
growse.com › 2020 › 04 › 26 › adventures-in-rust-and-cross-compilation-for-the-raspberry-pi.html
Adventures in Rust and Cross Compilation for the Raspberry Pi :: growse.com
April 26, 2020 - We also need to set the environment variable REALGCC to be the actual cross-compiler we want to use, as this is then invoked by musl-gcc. The default (I think) is just to invoke the gcc for whatever the current arch is, and we don’t want that (we want ARM!). $ REALGCC=arm-linux-gnueabihf-gcc-8 TARGET_CC=musl-gcc cargo build --target=arm-unknown-linux-musleabihf ... error: linking with `cc` failed: exit code: 1 /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/crt1.o: error adding symbols: File in wrong format collect2: error: ld returned 1 exit status
🌐
Stack Overflow
stackoverflow.com › questions › 76994311 › cross-compile-rust-for-raspberry-pi-1-model-b
Cross-compile Rust for Raspberry Pi 1 Model B - Stack Overflow
Anyway, I believe you should be able to get ld it to find the lib with CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUSTFLAGS=-Clink-arg=-Wl,-L/usr/lib/arm-linux-gnueabihf, but I don't expect that to fix the segfault. (I'll add this as an answer if you can confirm it works.) ... You need to also cross-compile libudev for your target, or to get libudev.so from your target and copy it to your build machine (/root/down/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/bin/../libc/usr/lib/libudev.so seems the right place to put it).
🌐
HackerNoon
hackernoon.com › building-a-wireless-thermostat-in-rust-for-raspberry-pi-part-2
Rust Cross Compiling to the Raspberry Pi | HackerNoon
October 31, 2022 - Efficiently set up a development environment for cross-compiling Rust code for other platforms, including Raspberry Pi and AWS Lambda.
🌐
Jakewharton
jakewharton.com › cross-compiling-static-rust-binaries-in-docker-for-raspberry-pi
Cross-compiling static Rust binaries in Docker for Raspberry Pi – Jake Wharton
May 27, 2021 - On my Mac I was able to install it with brew install arm-linux-gnueabihf-binutils. (Despite using the musl compilation target, the GNU linker will still work.) This is enough to compile working binaries! $ cargo build --target armv7-unknown-linux-musleabihf --release $ cargo build --target arm-unknown-linux-musleabihf --release · I really like to make my binaries and Docker containers as small as possible. Once again Rust's Cargo gives us a simple mechanism to achieve this in our Cargo.toml:
🌐
Rustrepo
rustrepo.com › repo › japaric-rust-cross-rust-embedded
Everything you need to know about cross compiling Rust programs! | RustRepo
February 1, 2023 - How do I cross compile from Linux to Mac? How do I compile a fully statically linked Rust binary ... Let's make sure we are talking the same language by defining some terms first! In its most basic form, cross compiling involves two different systems/computers/devices. A host system where the program is compiled, and a target system where the compiled program gets executed. For example, if you cross compile a Rust program on your laptop to execute it on a Raspberry Pi 2 (RPi2).