Cross-Compiling Plugins

Up until now I’ve been working on both a Linux (Ubuntu) laptop and a Windows desktop machine. I compile and test my plugins for both linux and windows, and rely on very helpful others in the community to compile for Mac, so that people can get my plugins before they land in the plugin manager.

Going forward windows may not be a practical option for me, so I was wondering if anyone is successfully cross-compiling windows and mac versions on a linux installation. If so, I would appreciate some pointers.

Obviously ‘cross-testing’ is not on my wishlist.

I think Andrew is cross compiling that way, from Linux.

I use Arch Linux with Docker with Ubuntu 16.04 for Linux, mingw-w64 for Windows, and oscross with the MacOS 10.11 SDK for Mac.

2 Likes

Similar to Andrew’s setup I can cross compile on Linux to Windows and Mac. Windows is no problem at all with mingw. Mac is a little more involved to set up the osxcross tool chain and technically requires you to have a Mac and access to the SDKs (licensing).

Well, i didnt do mac compilation previously, so its no great loss. I’ll look into mingw on linux. Thank you for the hint.

Does any of you guys has a small example on how to cross compile for windows using Linux?

I’m particularly interested in the environment configuration necessary for building the binaries correctly.

1 Like

Windows is the easiest, thanks to Mingw64.

CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ STRIP=x86_64-w64-mingw32-strip RACK_DIR=... make -j$(nproc) dist
1 Like

Another approach: use a CI system that can compile for other archs. This thread is how I do it, and it has details on doing it with Azure builds as well.

2 Likes

Thanks! Seems to work fine. I can compile the binaries in my Linux Vm.

Anyone have a working Dockerfile for OS X cross-compilation they feel like sharing? It looks like the obvious published osxcross images on Dockerhub are pretty old (Debian Jessie, 10.8.)

I’ve got a GitHub Actions setup that, on every merge to master, builds Windows and Linux and posts them on the GitHub releases page, in case that’s helpful for anyone. If you’re in the GitHub Actions beta you can probably reuse this workflow with little to no modifications.
https://github.com/Dewb/monome-rack/tree/master/.github

1 Like

I updated your actions to new YML format, as well as collapsing together some steps to speed them up a bit: https://github.com/xaviershay/vitamin-vcv-modules/

I haven’t fixed OSX though :frowning:

1 Like

I’ve just copied the actions from @xaviershay and mangled them for my plugin. They seem to be working including OSX. The only change I had to make to the OSX build was to include rsync in the list of packages in the Dockerfile.

Thanks to @Dewb @xaviershay.

However, I have of course no way of testing that what the osx build built, actually works. (or the windows build for that matter)

Anyway, if you want to look at them, go ahead: on the master branch

https://github.com/david-c14/SubmarineFree

I put the built artifacts here:

https://github.com/david-c14/SubmarineFree/releases/tag/v1.1.0

1 Like

I have just written up a wiki page on what I did to get github to build my plugin for me on linux, windows and macOS.

maybe it will give you some pointers if you want to do something similar.

6 Likes