I’m always looking for a cross-compiling system for building macOS executables from Linux, either as a single static executable, or as a self-contained relocatable bundle of (interpreter + libraries + user code entrypoint), because getting legal Mac build workers is such a pain.
The best toolkit I’ve found, by far, is golang Where you just GOOS=darwin go build .... There are a variety of more-or-less hacky solutions in the Javascript ecosystem, and a few projects for Python, but for Ruby this area is sorely lacking.
I mention this because while XAR looks like an awesome way to distribute software bundles, I still need to figure out a way to do nice cross-compiles if I’m going to use it to realistically target both macOS and Linux.
Tell me about it. I’ve tried cross compiling Rust from Linux to OSX and
it was just a saga of hurt from start to finish.
For Go, did you need to jump through the hoops of downloading an
out-of-date Xcode image, extracting the appropriate files and compiling
a cross-linker? Or is that mysteriously handled for you by the Go
distribution itself?
Go basically DIYs the whole toolchain and directly produces binaries. That has pros and cons, but means it can cross-compile without needing any third-party stuff like the Xcode images. For example it does its own linking, so it doesn’t need the Xcode / LLVM linker to be installed for cross-compilation to Mac.
No reason you can’t put a whole virtualenv, python interpreter and all, into your XAR. XAR can pack anything.
You still need a tool to prepare that virtualenv so that you can pack it, and that’s the sort of tool I struggle to find - cross-compiling a venv, or equivalent in other languages.
By this you mean, you’re looking for a solution for Python packaging that makes it as easy as Go to distribute universally?
I used this once before to take some code I wrote for Linux (simple cli with some libraries - click, fabric, etc.) and release it for Windows: http://www.py2exe.org/index.cgi/Tutorial
The Windows users on my team used the .exe file and it actually worked. It was a while back but I remember that it was straightforward.
Favorite line so far:
I’m always looking for a cross-compiling system for building macOS executables from Linux, either as a single static executable, or as a self-contained relocatable bundle of (interpreter + libraries + user code entrypoint), because getting legal Mac build workers is such a pain.
The best toolkit I’ve found, by far, is golang Where you just
GOOS=darwin go build .... There are a variety of more-or-less hacky solutions in the Javascript ecosystem, and a few projects for Python, but for Ruby this area is sorely lacking.I mention this because while XAR looks like an awesome way to distribute software bundles, I still need to figure out a way to do nice cross-compiles if I’m going to use it to realistically target both macOS and Linux.
Tell me about it. I’ve tried cross compiling Rust from Linux to OSX and it was just a saga of hurt from start to finish.
For Go, did you need to jump through the hoops of downloading an out-of-date Xcode image, extracting the appropriate files and compiling a cross-linker? Or is that mysteriously handled for you by the Go distribution itself?
You literally just run
GOOS=<your target os> GOARCH=<your target architecture> go build. No setup needed. Here’s the vars go build inspects.It’s frustrating trying to do similar in compiles languages, and then interpreted languages with native modules are even worse.
Go basically DIYs the whole toolchain and directly produces binaries. That has pros and cons, but means it can cross-compile without needing any third-party stuff like the Xcode images. For example it does its own linking, so it doesn’t need the Xcode / LLVM linker to be installed for cross-compilation to Mac.
AFAICT, XAR still doesn’t include the Python interpreter, so it’s not completely independent?
No reason you can’t put a whole virtualenv, python interpreter and all, into your XAR. XAR can pack anything.
You still need a tool to prepare that virtualenv so that you can pack it, and that’s the sort of tool I struggle to find - cross-compiling a venv, or equivalent in other languages.
I think most OSS work uses the Mac builders on Travis CI for building mac binaries.
Yes, exactly. I am less interested in different formats and more in a tool to create them. The ease of doing that with Go is the target.
By this you mean, you’re looking for a solution for Python packaging that makes it as easy as Go to distribute universally?
I used this once before to take some code I wrote for Linux (simple cli with some libraries - click, fabric, etc.) and release it for Windows: http://www.py2exe.org/index.cgi/Tutorial
The Windows users on my team used the .exe file and it actually worked. It was a while back but I remember that it was straightforward.