Cross Compiler for MacOS
- MacOS is worthy Release Target for a Software since many people use it.
- MacOS is required officially to develop for MacOS(also because of SDKs) and not everyone owns Mac Devices. Thus, Cross Compiling to MacOS is necessary.
- For cross-compiling to MacOS , you require Apple SDK and osxcross (wrapper to Clang).
- Compiling osxcross takes time. Also , Size of osxcross after compilation is >500MB thus making osxcross unfit to compile during CI/CD.
crossmac
is Pre-Built osxcross (MacOS cross compiler) with SDK taken from phracker/MacOSX-SDKs.- Github Actions is used to build
crossmac
. - It is heavily compressed(from
~550MB to ~50MB
) usingzstd
. - It is ideal to use for CI/CD or if you don't want to compile osxcross.
- It's built on Void Linux and works properly on not-old Linux glibc Distributions.
-
Download crossmac and extract it.
-
Add
lib/
folder of crossmac toLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:CROSSMAC/lib/
-
Add
bin/
folder of crossmac toPATH
export PATH=$PATH:CROSSMAC/bin/
-
Make sure that you have
clang
orgcc
installed (clang
is preferred). -
You can use
o64-clang
/o64-clang++
to target for Intel Mac Devices . You can useoa64-clang
/oa64-clang++
to target for Apple Silicon Mac Devices (arm64
devices). -
Refer osxcross for More Information.