Building Eglibc Headers & GCC2 in the Cygwin VM

  1. Update C:\Cygwin\opt\crosstool\src\build_gcc_cross.sh :

    #!/bin/bash
    
    export TARGET=arm-linux-gnueabihf
    export PREFIX=/opt/crosstool/gcc-4.6.3-eglibc-2.13/$TARGET
    export PATH=$PATH:$PREFIX/bin
    
    cd /opt/crosstool/src/build-eglibc
    find . -delete
    BUILD_CC=gcc \
    CC=$PREFIX/bin/$TARGET-gcc \
    CXX=$PREFIX/bin/$TARGET-g++ \
    AR=$PREFIX/bin/$TARGET-ar \
    RANLIB=$PREFIX/bin/$TARGET-ranlib \
    MAKEINFO=: \
    ../eglibc-2.13/configure \
        --prefix=/usr \
        --with-headers=$PREFIX/usr/include \
        --build=i686-pc-cygwin \
        --host=$TARGET \
        --enable-kernel=3.0.0 \
        --disable-profile --without-gd \
        --without-cvs --enable-add-ons
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to configure eglibc ==="
        exit 1
    fi
    make install_root=$PREFIX \
        install-headers install-bootstrap-headers=yes
    if [ "$?" -ne "0" ]; then
        echo -n "=== build script: "
        echo "failed to make eglibc headers ==="
        exit 1
    fi
    mkdir -p $PREFIX/usr/lib
    make csu/subdir_lib
    if [ "$?" -ne "0" ]; then
        echo -n "=== build script: "
        echo "failed to make eglibc csu subdir_lib ==="
        exit 1
    fi
    cp csu/crt1.o csu/crti.o csu/crtn.o $PREFIX/usr/lib
    if [ "$?" -ne "0" ]; then
        echo -n "=== build script: "
        echo "failed to install eglibc csu subdir_lib ==="
        exit 1
    fi
    $PREFIX/bin/$TARGET-gcc -nostdlib -nostartfiles \
        -shared -x c /dev/null -o $PREFIX/usr/lib/libc.so
    if [ "$?" -ne "0" ]; then
        echo -n "=== build script: "
        echo "failed to install eglibc fake libc.so ==="
        exit 1
    fi
    
    cd /opt/crosstool/src/build-gcc
    find . -delete
    ../gcc-4.6.3/configure --target=$TARGET --prefix=$PREFIX \
        --with-sysroot=$PREFIX --disable-libquadmath \
        --with-arch=armv6 --with-fpu=vfp --with-float=hard \
        --disable-sjlj-exceptions --enable-checking=release \
        --enable-linker-build-id --enable-gnu-unique-object \
        --disable-nls --enable-languages=c --with-headers \
        --disable-multilib --disable-libmudflap --disable-libssp \
        --disable-libgomp --without-ppl --without-cloog \
        --with-gmp=/usr/local --with-mpfr=/usr/local \
        --with-mpc=/usr/local
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to configure gcc ==="
        exit 1
    fi
    make
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to make gcc ==="
        exit 1
    fi
    make install
    if [ "$?" -ne "0" ]; then
        echo "=== build script: failed to install gcc ==="
        exit 1
    fi
    
    echo "=== build script: OK ==="
    

  2. You may need to reapply dos2unix to build_gcc_cross.sh if your text editor does not preserve DOS/Unix line endings.
  3. Run C:\Cygwin\opt\crosstool\src\build_gcc_cross.cmd and wait until it completes.
  4. If there are no errors, shudown the Cygwin VM and make snapshot "SNAP-7".

Additional steps to support SoftFP ABI:

  1. Replace TARGET=arm-linux-gnueabihf with TARGET=arm-linux-gnueabi and ../gcc-4.6.3/configure with ../gcc-4.6.3.noarmhf/configure and ../eglibc-2.13/configure with ../eglibc-2.13.noarmhf/configure in build_gcc_cross.sh
  2. gcc configure flags: --with-arch=armv4t --with-float=soft. Also remove --with-fpu=vfp.
  3. You may need to reapply dos2unix to build_gcc_cross.sh if your text editor does not preserve DOS/Unix line endings.
  4. Run C:\Cygwin\opt\crosstool\src\build_gcc_cross.cmd and wait until it completes.
  5. If there are no errors, shudown the Cygwin VM and make snapshot "SNAP-8".


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