[Vm-dev] mingw cross compile on Travis

Ben Coman btc at openinworld.com
Sun Jan 6 16:44:35 UTC 2019


Just something interesting I learnt today...

# Background

In
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/scripts/installCygwin.bat

I noticed mingw packages being installed.

so I wanted to refresh myself on the difference between Cygwin and Ming.
Beside confirming my existing understanding that Mingw links against
Microsoft libraries
while Cygwin links against its own Posix library, I learnt a new and finer
distinction that...
    Mingw is a cross compiler that runs in the Cygwin environment.

That made me wonder about mingw cross compiling from other environments.  I
found this article indicating it was possible...
http://www.blogcompiler.com/2010/07/11/compile-for-windows-on-linux/

# Testing

I got it working first with Windows 10 Subsystem For Linux
and then with Travis using this repo...
https://github.com/bencoman/travis-mingw-test
The build logs are viewable here...
https://travis-ci.org/bencoman/travis-mingw-test/builds
and build products downloadable here...
https://github.com/bencoman/travis-mingw-test/releases/latest
Try running them on Windows.

You can try it out locally on Windows 10 WSL by doing...
    $ sudo apt-get install mingw-w64
    $ git clone https://github.com/bencoman/travis-mingw-test.git
    $ cd travis-mingw-test
    $ ./build.sh
then in a Windows shell...
    cd C:\tmp\hello
    hello-w32.exe
        Hello World!

At the start of today I had no clue Travis could do something like that
and it feels super cool to have done it!  ...so just had to share.
cheers -ben


P.S. My WSL platform is...
$ uname -a
Linux BENGINEER 4.4.0-17134-Microsoft #471-Microsoft Fri Dec 07 20:04:00
PST 2018 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20190107/9486b818/attachment-0001.html>


More information about the Vm-dev mailing list