mingw cross compile on Travis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

mingw cross compile on Travis

Ben Coman
 
Just something interesting I learnt today...

# Background

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...

# 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
    $ 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"