

Then, we need to also tell the compiler to use the right compiler and headers. Linker = "/home/my-user-name/macosx-cross-compiler/cross-compiler/bin/x86_64-apple-darwin14-cc" Mac OS X programs: echo "" > $HOME/.cargo/configįind $MACOSX_CROSS_COMPILER -name x86_64-apple-darwin14-cc -printf 'linker = "%p"\n' > $HOME/.cargo/configĪfter this, your $HOME/.cargo/config (not the cargo.toml file in your project, this is a different file) Now you need to tell Rust to use it when linking build.shĪt this stage, you should have, in $MACOSX_CROSS_COMPILER/cross-compiler, UNATTENDED=yes OSX_VERSION_MIN=10.7 TARGET_DIR=$MACOSX_CROSS_COMPILER/cross-compiler. Mv MacOSX10.10. $MACOSX_CROSS_COMPILER/osxcross/tarballs/ # move the file where osxcross expects it to be You should now have an SDK file, for example MacOSX10.10. Please ensure you have read and understood the Xcode license terms before continuing. Which can not be distributed with osxcross for legal reasons. Git checkout 7c090bd8cd4ad28cf332f1d02267630d8f333c19Īt this stage you need to download and package the SDK # picked this version as they work well with godot-rust, feel free to change Install -d $MACOSX_CROSS_COMPILER/cross-compiler Install -d $MACOSX_CROSS_COMPILER/osxcross

# change the following path to match your setupĮxport MACOSX_CROSS_COMPILER=$HOME/macosx-cross-compiler Sudo apt-get install llvm-dev libclang-dev clang libxml2-dev libz-dev Howto # make sure you have a proper C/C++ native compiler first, as a suggestion: Which is just about setting up a working C/C++ compiler on Linux. Hopefully, the first two steps, downloading the SDK and fixing details,


Need a Mac OS X C/C++ compiler, the Rust compiler is not enough. Why is this complex ?Ĭross-compiling Rust programs for Mac OS X is as simple as: rustup target add x86_64-apple-darwin If you have access to a real Mac, building natively is easier.
