Cross-compiler targeting macOS
Jacob Carlborg
doob at me.com
Thu Apr 8 08:23:27 UTC 2021
On 2021-04-07 17:27, Guillaume Piolat wrote:
> Dumb question maybe but: in what use cases should this be used?
I don't know, ask H. S. Teoh :D.
I know some people have asked for it. I did it mostly because I knew how
to do it and do it properly. I general I don't see the point to
cross-compile (unless it's required, like mobile an embedded), because
it seems like people want to use cross-compiling because they don't have
the target system. But eventually you need to test the result and then
you do need the target system to be able to run it. But perhaps if you
target Windows you can then use Wine to run the executable. Seem to be
something similar for macOS [1]. But if you can run the result using
Wine you should be able to run the compiler using Wine as well. Perhaps
it's less of a hassle to cross-compile, I don't know.
If you're targeting Linux on non-native architectures you can use qemu.
Seems pretty easy if you have a statically linked binary and use qemu
user emulation.
There's also free public CI services that target macOS, no need to
cross-compile and it can run the code as well.
I did have a use case at my previous job. The production systems were
running Linux but all developers were using macOS. We created a custom
tool for the developers, which then needed to target macOS. It was a GUI
application so Docker wasn't an option. We only had access to Linux CI
runners so I used cross-compiling. It couldn't test the result, but at
least it could build it and publish it. That's when I setup the first
incarnation of this project [2]. In this new incarnation, I've fixed the
main problem of the first incarnation: reproducibility.
[1] https://www.darlinghq.org
[2] https://github.com/jacob-carlborg/docker-ldc-darwin
--
/Jacob Carlborg
More information about the Digitalmars-d-announce
mailing list