Compile gcc 4.9.4 + latest-Mingw-w64 on linux 2019.05

本文档详细介绍了如何在Linux环境下编译GCC 4.9.4和最新的Mingw-w64,以创建能够在Windows XP及其以上x32/x64系统上运行的静态编译软件。步骤包括构建Binutils、 Mingw-w64头文件、创建软链接、编译GCC、构建mingw-w64-crt、libgcc和pthreads。
摘要由CSDN通过智能技术生成

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 --

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值