
4 keys for writing cross-platform apps
Some languages have tools and features to make cross-compiling less of a pain. Rust, for example offers cross compilation as semi-native functionality in its toolchain. But you’ll still need to add some extra stuff – like a proper linker – to get the job done.
One of the big problems with cross-platform compilation is how asymmetric it could be. If you’re a macOS user, you can easily set up and maintain Windows or Linux virtual machines on your Mac. If you’re using Linux or Windows, emulating macOS on those platforms is more difficult. No impossibleit’s just more complicated – the main reason is legal issues, since the macOS license agreement doesn’t allow it to be used on third-party hardware. The easiest workaround (though not the cheapest) is to simply buy a separate Macintosh system and use that. Another option is to use tools like osxcross to perform cross-compilation on a Linux, FreeBSD or OpenBSD system.
Another common option that is most consistent with modern software delivery methods is to use a system such as GitHub Actions (by using Runners hosted on GitHub) or Azure pipelines to build your software on any of the supported target platforms. (Both GitHub and Azure support macOS.) The downside is paying to use the service, but if you’ve already invested in either platform, it’s often the most cost-effective and least confusing approach. Additionally, it relieves you of the burden of system maintenance.
2025-01-01 09:00:00