In previous posts I covered some prerequisite information for compiling GCC-4.x.x, such as downloading the GCC-4.x.x package and downloading/compiling the proper GPM and MPFR libraries.
The first thing to do after uncompressing the tarball is to make a build directory, generally in the same directory as the source directory. For example, if the source directory is gcc-4.x.x, create a build directory called gcc-4.x.xbuild.
The next step is to properly configure/make/make install GCC-4.x.x. For general users, the default settings work fine and the following commands are sufficient:
> cd /path/to/gcc-4.x.xbuild
> ../gcc-4.x.x/configure
> make bootstrap
> sudo make install
However, there are many times that the default setting are not sufficient and must be changed. Some examples where alternate setting are needed are:/usr/local
To see information on available configure options, type ./configure --help in the gcc-4.x.x source directory. Some configure options are platform dependent and if you have problems a good place to start is to look at the configure options used for the default system compiler by executing gcc -v to see a list of the configure options used. Some of the options that I use most are listed below:
Generally, when I am bootstrapping GCC-4.x.x for CFD work, I build only the c,c++, and fortran languages. In addition, I always perform bootstrap builds and perform the make check step to verify the build. Also, since I am a CFD researcher/developer and may need to run my code on a variety of platforms, I bootstrap generally bootstrap GCC with static enabled and shared disabled, but with PIC. This enables me to move the CFD executables to machines that do not have the same GCC libraries, while allowing me to link in shared object files as needed. Below is a typical bootstrap configuration and build process that I would use:
> cd path/to/gcc-4.3.3build
> ../gcc-4.3.3/configure --prefix=/usr/local/gcc433 --mandir=/usr/share/man --infodir=/usr/share/info --disable-shared --enable-static --with-pic --enable-threads=posix --disable-multilib --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,fortran --with-cpu=k8 --with-gmp=/usr/local/gmp422-mpfr231 --with-mpfr=/usr/local/gmp422-mpfr231 --program-suffix=-433
> make bootstrap 2>&1 | tee make.log
> make -k check 2>&1 | tee make.log
> sudo make install
Notice the custom install directory indicated by the prefix option, the custom gmp and mpfr versions and directories, and the use of the program suffix -433 to make sure that I always know the version of gcc I am using for compilation. The above worked well for a Linux CentOS-4.4 OS on a dual processor, dual core AMD opteron system.
Well, that completes a brief introduction to bootstrapping the GCC-4.x.x compiler series. If you have questions. comments, or corrections, please hop over to my website http://clusternut.net and click the clusternut forums link.