Hacker News new | ask | show | jobs
by planede 1132 days ago
Technically it's possible, but possibly not legal:

https://github.com/tpoechtrager/osxcross

> Please ensure you have read and understood the Xcode license terms before continuing.

According to the EULA you may only use the SDK on Apple-branded computers. But you can use Linux to cross compile to Apple.

Do the Visual Studio build tools have more permissive license terms? AFAIK you can have clang-cl on Linux, but you do need a lot of the SDK for it to be useful. No experience there.

3 comments

At least in the EU, there's precedent for click-through EULAs like the XCode one being unenforcable.
For Windows, MinGW has an independent implementation of the complete build environment so you don't need any VS tools, import libraries or headers. For macOS there is no such complete build root but the actual tools are available - e.g. clang is always a cross-compiler able of targetting all supported architectures and for the linker Apple's own ld64 is open source and we also have lld now although I am not certain the macOS target status.

> AFAIK you can have clang-cl on Linux

clang-cl is a frontent for MSVC command-line compatibility - you don't even need that for cross-compiling, just -target and then whatever -fms-* extensions you need for your non-portable code. But yes, Clang doesn't come with its own SDK so you will need headers and import libraries and possibly other tooling (although the LLVM procect covers a lot).

It's unfortunately not legal. Makes it also not commercially viable. Cross-compiling is nice, but if the build toolchain requires xcode, then it doesn't help all that much, since the last and most important step has to be done on apple hardware.
At least you can build on docker runners instead of fragile shell runners on MacOS. But any benefits are probably not worth the cost of complexity of cross compilation.