Open svet-b opened 2 years ago
Hmmm. By default the Rust build for the '-sys' crate tries to compile the Paho C library from a Git submodule. For the most part it just runs CMake on the library with a few definitions appropriate for the Rust wrapper.
To do this we use the Rust 'cmake' crate, which largely takes care of dealing with cross-compilation.
With just a quick look, I'm not sure which is injecting the '-arch' option. My guess is probably the Rust CMake crate, but it needs some investigation.
I don't have an M1 Mac, but I don't think this is a problem with the build host, so I can run some tests with other hosts. But unfortunately this is likely an issue that needs to be fixed in an upstream dependency.
Thanks for taking a look @fpagliughi! As I said I'm not so familiar with the overall build process, but inclined to agree that it's an upstream issue. I guess most other crates don't build C code, which is why this is the first time that I'm encountering the issue.
And indeed, based on the symptoms I think it's probably a general Mac issue rather than M1-specific.
Yeah, I had hoped to rewrite the library by now to be 100% Rust, but there's never enough time to get it done! Most of the reported issues for this library revolve around build and portability issues involving the C lib. I'll have some time to take a closer look in the next few days.
Any updates on this? I'm running into the same issue. Other crates with -sys dependencies build fine though -e.g. openssl itself.
I'm stuck with the same as well (on M1 mac, of course). Is there anything someone would like me to start looking into? I'm semi-useless as I have just now started playing with this side of rust and cross compilation for Raspberry Pi...
I'm building on an M1 Mac (arm64) for an
armv7-unknown-linux-musleabihf
target, and facing what looks to be a simple compilation issue below. By the way, I have no issues with either of the following:paho-mqtt
on the Mac hostpaho-mqtt
crate for this target when building on a Linux hostTherefore I believe this to be specific to building
paho-mqtt
on a Mac.I have the following in
Cargo.toml
:(but same issue with latest stable release)
I'm using
gcc
from the toolchain at https://github.com/messense/homebrew-macos-cross-toolchains.The main error is
My analysis: while
-arch
appears to be a valid option for Apple's nativegcc
, it's generally not valid for cross-compilation toolchains (related discussion). I don't know the details as to why the-arch
option is used in the build script here, but perhaps it's not actually necessary (since-march
is also passed). Unfortunately I'm not sufficiently familiar with the build process to figure out where in the codebase to look for a solution.The full build error log is as follows: