Building GCC Dependencies in the MinGW VM

Important note: --build and --host options are here to prevent libraries from binding to latest CPU features like AVX2.

  1. Update C:\MinGW\msys\1.0\opt\crosstool\src\build_gcc_cross.sh :

    #!/bin/bash
    export PATH=.:/usr/local/bin:/mingw/bin:/bin
    export PATH=$PATH:/c/WINDOWS/system32:/c/WINDOWS
    export PATH=$PATH:/c/WINDOWS/System32/Wbem
    
    cd /opt/crosstool/src/build-gmp
    ../gmp-6.1.2/configure \
       --build=i586-pc-mingw32 --host=i586-pc-mingw32 \
       --disable-shared --enable-static
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to configure libgmp ==="
        exit 1
    fi
    make
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to make libgmp ==="
        exit 1
    fi
    make check
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to check libgmp ==="
        exit 1
    fi
    make install
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to install libgmp ==="
        exit 1
    fi
    
    cd /opt/crosstool/src/build-mpfr
    ../mpfr-4.0.2/configure \
       --build=i586-pc-mingw32 --host=i586-pc-mingw32 \
       --with-gmp=/usr/local --disable-shared --enable-static
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to configure libmpfr ==="
        exit 1
    fi
    make
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to make libmpfr ==="
        exit 1
    fi
    make check
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to check libmpfr ==="
        exit 1
    fi
    make install
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to install libmpfr ==="
        exit 1
    fi
    
    cd /opt/crosstool/src/build-mpc
    ../mpc-1.1.0/configure \
       --build=i586-pc-mingw32 --host=i586-pc-mingw32 \
       --with-gmp=/usr/local --disable-shared --enable-static
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to configure libmpc ==="
        exit 1
    fi
    make
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to make libmpc ==="
        exit 1
    fi
    make check
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to check libmpc ==="
        exit 1
    fi
    make install
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to install libmpc ==="
        exit 1
    fi
    
    cd /opt/crosstool/src/build-expat
    find . -delete
    cp -R ../expat-2.2.9/. .
    ./configure --disable-shared --enable-static
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to configure expat ==="
        exit 1
    fi
    make
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to make expat ==="
        exit 1
    fi
    make install
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to install expat ==="
        exit 1
    fi
    
    echo "=== build script: OK ==="
    

  2. Run C:\MinGW\msys\1.0\opt\crosstool\src\build_gcc_cross.cmd and wait until it completes.
  3. If there are no errors, shutdown MinGW VM and make snapshot "SNAP-C".


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