//
MacOSX Rust Cross-Compile to Linux Steps and Common Issues
Install musl-cross
brew install FiloSottile/musl-cross/musl-cross
sudo ln -s /usr/local/bin/x86_64-linux-musl-gcc /usr/local/bin/musl-gccEncountered Issue:
==> make install
Error: gettext: unknown or unsupported macOS version: :dunnoSolution:
brew update-resetAdd Content to .cargo/config
[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"If this file does not exist, just create it.
Add Target: x86_64-unknown-linux-musl
rustup target add x86_64-unknown-linux-muslStart Compiling Happily
cargo build --release --target x86_64-unknown-linux-muslEncountered Issue:
error: failed to run custom build command for `openssl-sys v0.9.95`Solution:
brew install openssl
export OPENSSL_DIR=/opt/homebrew/opt/openssl@3Encountered Another Issue:
reqwest.38a55170626eab39-cgu.02:(.text._ZN4core3ptr44drop_in_place$LT$reqwest..connect..Inner$GT$17h0198ea10d7817d8cE+0x38): undefined reference to `SSL_CTX_free'Solution: need to add openssl dependency in Cargo.toml.
openssl = { version = "0.10", features = ["vendored"] }