This is an experimental Docker-based version of MXE.
MXE is a nice cross compiling environment with many free libraries. See their site for more.
The only dependency here is Docker itself, everything else will automatically happen inside the Docker container.
-
Clone this repo or download a tarball:
git clone https://github.com/lbguilherme/dmxe cd dmxe
-
Prepare the MXE image. This will fetch the lastest Debian image and install all dependencies. Then it will clone the mxe repo inside it.
./dmxe prepare
-
Make the libraries you need. This will launch the container and invoke
make
there with whatever you pass here:./dmxe make gcc
-
Create your first code to compile with MXE. For example:
// main.c #include <windows.h> int main() { MessageBoxA(0, "Hello World from Docker MXE!", "MXE", MB_OK); return 0; }
-
Run the image you have just built:
./dmxe run
You will be presented with a shell where you can access your current directory:
mxe@default:~$
-
Simply compile your file and exit.
i686-w64-mingw32.static-gcc
here is the cross compiler for the default target:mxe@default:~$ i686-w64-mingw32.static-gcc main.c -o main.exe mxe@default:~$ exit
-
Take a look on the file you have produced:
file main.exe # main.exe: PE32 executable (console) Intel 80386, for MS Windows
-
Run it! Wine is your friend.
wine main.exe