Compile gcc 4.9.4 + latest-Mingw-w64 on linux 2019.05
Compile gcc4.9.4 + Latest-Mingw-w64 under Linux, build Cross-compile-toolchain , to generate software which can run on windows xp and xp+ x32/x64.
We generate all static compile.
Reference:https://pete.akeo.ie/2010/07/compiling-mingw-w64-with-multilib-on.html
Reference: /run/media/lixing/6T_20181101_3/mingw32_20190521_src/mingw-w64-mingw-w64_master/mingw-w64-doc/howto-build/mingw-w64-howto-build.txt
finally directory layout:
/works/tools/compiler/mingw32/
bin
x86_64-w64-mingw32-c++, x86_64-w64-mingw32-gcc,…
lib
gcc
libexec
gcc
share
x86_64-w64-mingw32
bin
include
lib
lib32
mingw(ln -s x86_64-w64-mingw32 mingw ,it’s x86_64-w64-mingw32’s soft-link)
1.At first, build Binutils-2.29
cd /run/media/lixing/6T_20181101_3/mingw32_20190521_src/binutils-2.29
mkdir build
cd build
…/configure --prefix=/works/tools/compiler/mingw32 --with-sysroot=/works/tools/compiler/mingw32 --enable-gold --enable-ld --enable-lto --target=x86_64-w64-mingw32 --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32
make
make install
2.Compile mingw-w64-headers of mingw-w64-mingw-w64_master
cd /run/media/lixing/6T_20181101_3/mingw32_20190521_src/mingw-w64-mingw-w64_master/mingw-w64-headers
mkdir build
cd build
…/configure --host=x86_64-w64-mingw32 --prefix=/works/tools/compiler/mingw32/x86_64-w64-mingw32
make
make install
3.Create soft-link
cd /works/tools/compiler/mingw32
ln -s x86_64-w64-mingw32 mingw
4.Compile gcc4.9.4, Gcc, pass 1gmp-6.1.0.tar.gz
mpc-1.0.2.tar.gz
mpfr-3.1.4.tar.gz
unzip them to path gcc4.9.4 ,corresponding to decompressed folder name is:gmp,mpc,mpfr,so that gcc will found them when gcc compiling.
cd /run/media/lixing/6T_20181101_3/mingw32_20190521_src/gcc4.9.4
we need build gcc outside src directory.
cd …
mkdir gcc_build
cd gcc_build
Reference: /run/media/lixing/6T_20181101_3/mingw32_20190521_src/gcc4.9.4/INSTALL/configure.html
…/gcc4.9.4/configure --with-sysroot=/works/tools/compiler/mingw32 --prefix=/works/tools/compiler/mingw32 --enable-languages=c,c++ --enable-multiarch --enable-multilib --with-multilib-list=m32,m64 --disable-nls --target=x86_64-w64-mingw32 --with-system-zlib --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --