How to build the GCC-4.3.3 in MinGW?

来源:互联网 发布:佰迪清可以在淘宝买吗 编辑:程序博客网 时间:2024/05/16 11:37

How tobuild the GCC-4.3.3 in MinGW?

 

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

 

[Where to download GCC-4.3.3?]

Loginftp.gnu.org and find thelatest version. It is gcc-4.3.3.tar.bz2when I explore whole folder.

 

[Where to download GMP?]

Loginwww.sfr-fresh.com and findthe latest version. It is gmp-4.2.4.tar.gzwhen I explore the whole web page.

 

[Where to download MPFR?]

Login www.mpfr.org and find the latestversion. It is mpfr-2.4.1.tar.bz2when I explore the whole web page.

 

[Where to download pthread-win32?]

Loginpthreads-win32 and find thelatest dll version.It includes libpthreadGC2.a, pthreadGC2.dll, pthread.h, sched.h and semaphore.h.

 

[Where to download binutils-2.19.1?]

Loginsourceforge.netand 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 compiledwill be crashed in the runtime. In normal case, Binutils had better use thelatest version.

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

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