Deploying Inputs into the MinGW VM

1. Moving intermediary build results

  • Boot into your Cygwin VM, open Cygwin console, and run the following commands:
    $ cd /opt/crosstool/
    $ tar -h -zcvf gcc-4.9.2-glibc-2.19.tar.gz \
    Because target MinGW VM does not support symlinks, it's important to create tar archive with symlink dereferencing (-h option).
  • Copy gcc-4.9.2-glibc-2.19.tar.gz to a shared folder with a host and shutdown the Cygwin VM.
  • Boot into your MinGW VM, create new folder C:\MinGW\msys\1.0\opt\crosstool and copy gcc-4.9.2-glibc-2.19.tar.gz from shared folder with a host into recently created folder C:\MinGW\msys\1.0\opt\crosstool.
  • Open MinGW shell, and run the following commands:
    $ cd /opt/crosstool
    $ tar -zxf gcc-4.9.2-glibc-2.19.tar.gz
    $ cd gcc-4.9.2-glibc-2.19
    $ ls -l
    $ find . -name '*.exe' -or -name '*.dll' -delete
    Last command will remove all .exe/.dll files in the intermediary build results, because these binary files depend on cygwin1.dll and won't run in MinGW anyway. Also they won't run because our Cygwin environment is 64-bit and our MinGW environment is 32-bit.

2. Unpacking source code

Open MinGW shell, create directory /opt/crosstool/src (mkdir -p), and unpack binutils, gcc, mpc, mpfr and gmp into it. Use "tar zxf" to unpack .tar.gz files, "tar jxf" to unpack .tar.bz2 files, and "tar Jxf" to unpack .tar.xz files (grab these files from host system via shared folder).

You should get the following folders:


Source code for glibc is not required, because we have already built it.

3. Creating temporary folders for build

gcc and probably other software and libraries will not build in their source folders. So, please create build-gmp, build-mpfr, build-mpc, build-binutils and build-gcc subfolders in C:\MinGW\msys\1.0\opt\crosstool\src. These subfolders will contain intermediary build results when corresponding software will be built.

4. Creating script files

Also please prepare stub batch file C:\MinGW\msys\1.0\opt\crosstool\src\build_gcc_cross.cmd with the following contents:

@echo off
C:\MinGW\msys\1.0\bin\dos2unix.exe ^
    -l -c C:/MinGW/msys/1.0/opt/crosstool/src/

C:\MinGW\msys\1.0\bin\bash.exe ^ -l -c /opt/crosstool/src/

Also please prepare main build script file C:\Cygwin\opt\crosstool\src\ with the following contents:


echo "=== build script: OK ==="

Then run build_gcc_cross.cmd to make sure scripts work as expected.

It's recommended to shutdown MinGW virtual machine and make snapshot "SNAP-B" when initial deployment is done.

>> Read next section or buy already prepared cross-compiler (€10) to save your time.