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.4.1-glibc-2.10.1.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.4.1-glibc-2.10.1.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.4.1-glibc-2.10.1.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 -zxvf gcc-4.4.1-glibc-2.10.1.tar.gz
    $ cd gcc-4.4.1-glibc-2.10.1
    $ ls -l
    $ rm `find . -name '*.exe'`
    Last command will remove all .exe files in the intermediary build results, because these .exe files depend on cygwin1.dll and won't run in MinGW anyway.

2. Unpacking source code

Open MinGW shell, create directory /opt/crosstool/src (mkdir -p), and unpack binutils, gcc-core, gcc-g++, mpc, mpfr and gmp into it. Use "tar zxvf" to unpack .tar.gz files and "tar jxvf" to unpack .tar.bz2 files (grab those 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\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 ==="
and apply MinGW dos2unix tool to it in order to convert 0x0D,0x0A line endings (DOS/Windows format) to 0x0A line endings (UNIX format).

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.