How to build the GCC-4.3.3 in MinGW?

本文详细介绍了如何从头开始在MinGW环境中构建GCC-4.3.3及其依赖项,包括GMP、MPFR和Binutils等。步骤涉及下载源码包、配置编译参数及安装过程。

How to build the GCC-4.3.3 in MinGW?

 

The package is essential to build the environment of GCC. If you have installed them into your MinGW, please skip to the next session.

 

[Where to download GCC-4.3.3?]

Login ftp.gnu.org and find the latest version. It is gcc-4.3.3.tar.bz2 when I explore whole folder.

 

[Where to download GMP?]

Login www.sfr-fresh.com and find the latest version. It is gmp-4.2.4.tar.gz when I explore the whole web page.

 

[Where to download MPFR?]

Login www.mpfr.org and find the latest version. It is mpfr-2.4.1.tar.bz2 when I explore the whole web page.

 

[Where to download pthread-win32?]

Login pthreads-win32 and find the latest dll version. It includes libpthreadGC2.a,  pthreadGC2.dll, pthread.h, sched.h and semaphore.h.

 

[Where to download binutils-2.19.1?]

Login sourceforge.net and download binutils-2.19.1-src.tar.gz.

 

[1. Build and Install gmp-4.2.4.tar.gz]

$ tar xvzf ./gmp-4.3.4.tar.gz

$ cd ./gmp-4.2.4/

$ ./configure --prefix=/mingw –disable-shared –enable-static

$ make

$ make check

$ make install

$ make distclean

 

[2. Build and Install mpfrmpfr-2.4.1.tar.bz2]

$ tar xvjf ./mpfr-2.4.1.tar.bz2

$ cd ./mpfr-2.4.1/

$ ./configure --prefix=/mingw –disable-shared –enable-static –with-gmp=/mingw

$ make

$ make check

$ make install

$ make distclean

 

[3. Copy pthread into MinGW]

$ cd ./pthreads

$ cp -f ./pthread.h /mingw/include

$ cp -f ./sched.h /mingw/include

$ cp -f ./semaphore.h /mingw/include

$ cp -f ./pthreadGC2.dll /mingw/bin

$ cp -f ./libpthreadGC2.a /ming/lib/libpthread.a

 

[4. Build and Install gcc-4.3.3.tar.bz2]

$ tar xvjf ./gcc-4.3.3.tar.bz2

$ mkdir –p ./gcc-4.3.3/build

$ cd ./gcc-4.3.3/build

$ export LD_RUN_PATH=/mingw/lib

$ export LD_LIBRARY_PATH=/mingw/lib

$ LD_RUN_PATH=/mingw/lib LD_LIBRARY_PATH=/mingw/lib ../configure --prefix=/mingw --with-gmp=/mingw --with-mpfr=/mingw --oldincludedir=/mingw/include --disable-nls --disable-win32-registry --disable-shared --enable-version-specific-runtime-libs --enable-languages=c,c++,fortran,java,objc --enable-optimize --enable-libgomp
$ make

$ make DESTDIR=/gcc-4.3.3-build install

$ make install

$ rm -rf *

 

[5. Build and Install binutils-2.19.1-src.tar.gz]

$ tar xvzf ./binutils-2.19.1-src.tar.gz

$ cd binutils-2.19.1/

$ ./configure --prefix=/mingw –disable-shared –enable-static –oldincludedir=/mingw/include --with-mpfr=/mingw --with-gmp=/mingw

$ make

$ make DESTDIR=/ binutils-2.19.1-build install

$ make install

$ make distclean

$ rm -rf /mingw/mingw32

$ mv /mingw/ i686-pc-mingw32 / mingw/mingw32

 

[Summarization]

1. GCC and Binutils must be synchronized together, otherwise the programs compiled will be crashed in the runtime. In normal case, Binutils had better use the latest version.

2. The boring operations in every step should be edited into a shell script, and it will help readers automatically build all tasks. As readers know, it takes long time to completely build GCC.

3. If readers want to know HOWTO in Linux. Please refer to “How to compile GCC-4.3.3 in the Linux?”.

 

你运行的命令: ```bash grep -r "with-float" . ``` 在当前 OpenWrt 项目目录中找到了一行输出,内容如下: ``` ./tplink/package/usr_package/wlan_tplink/apps/3g_tools/libusb-1.0.8/config.log:Configured with: ... --with-float=soft ... ``` --- ### 🔍 分析这行输出的含义 - 这个 `config.log` 文件是某个 **libusb-1.0.8** 库在编译时生成的日志文件。 - 它记录了该库在编译时使用的 **GCC 配置命令行**。 - 其中包含 `--with-float=soft`,这表示该库是在使用 **软浮点(soft float)** 的工具链环境下编译的。 - 该配置属于 **MIPS 架构(mips-linux-uclibc)**,而不是你当前正在构建的 aarch64 工具链。 --- ### ✅ 是否需要处理这个 `--with-float=soft`? **不需要。** - 这个配置属于历史构建产物(可能是 SDK 中自带的第三方包)。 - 不会影响你当前构建的 `aarch64` 工具链。 - 因为它不是你当前编译过程中使用的 GCC 配置项。 --- ### ✅ 当前你真正需要关注的 `--with-float` 配置位置 你需要关注的是: - GCC 工具链的配置文件(如 `toolchain/gcc/config-<version>.in` 或 `toolchain/gcc/Makefile`)。 - 或者 OpenWrt 的菜单配置项(通过 `make menuconfig` 查看)。 --- ### ✅ 推荐操作步骤 #### ✅ 1. 清理旧的构建缓存 ```bash make toolchain/clean rm -rf build_dir/toolchain-aarch64_cortex-a53_gcc-8.4.0_musl-1.2.4_eabi/ ``` #### ✅ 2. 查看当前 GCC 配置命令 ```bash make toolchain/gcc/initial/compile V=99 ``` 在输出中查找类似如下内容: ``` configure --prefix=... --target=aarch64-openwrt-linux ... --with-float=... ``` 如果发现有 `--with-float=xxx`,说明配置文件中仍然包含该参数。 #### ✅ 3. 搜索整个项目中是否还有 `--with-float` 的配置定义 ```bash find . -type f -name "*.in" -o -name "*.mk" -o -name "Makefile" | xargs grep -l "with-float" ``` #### ✅ 4. 如果找到相关配置文件,修改或删除 `--with-float` 行 例如在 `toolchain/gcc/config-8.4.0.in` 中找到: ```makefile --with-float=hard ``` 可以注释或删除它。 --- ### ✅ 总结 - 你刚才找到的 `--with-float=soft` 属于 MIPS 架构的 libusb 工具链配置,不影响 aarch64- 真正需要处理的是当前你正在构建的 aarch64 工具链中的 GCC 配置。 - 建议使用 `make toolchain/gcc/initial/compile V=99` 查看完整的 configure 命令。 --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值