The general idea is to install the latest version of gcc and glibc in a user directory. I chose /home/facultystaff2/wkim06/bin/gcc-install and home/facultystaff2/wkim06/bin/glibc-install as the final install directories for each. Then set the LD_LIBRARY_PATH to point to those install directories.
Be aware of the directory location for these commands as they are specific to the present working directory. Also, allow a day or two to complete everything.
The following error message appears if gcc is compiled without the required components:
[Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+. Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations. Source code for these libraries can be found at their respective hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also http://gcc.gnu.org/install/prerequisites.html for additional info. If you obtained GMP, MPFR and/or MPC from a vendor distribution package, make sure that you have installed both the libraries and the header files. They may be located in separate packages.]
As root, these requirements may be satisfied with the following:
yum install mpc-devel
if mpc-devel is not found, try libmpc-devel from epel
yum install libmpc-devel
which will install all the required components (except glibc).
As a user, mpc mpfr and gmp can be added to the source
First, download gcc-4.6.2.tar.gz (mpc, mpfr and gmp) and glibc-2.14.tar.gz in ~/bin from these locations:
$ cd ~/bin $ wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.6.2/gcc-4.6.2.tar.gz $ wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz $ wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2 $ wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
download glibc:
$ wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
untar them:
$ tar xf gcc-4.6.2.tar.gz $ tar xf mpc-0.8.1.tar.gz $ tar xf mpfr-2.4.2.tar.bz2 $ tar xf gmp-4.3.2.tar.bz2 $ tar xf glibc-2.14.tar.gz
move the components to the gcc directory:
$ mv ./mpc-0.8.1 ./gcc-4.6.2/mpc $ mv ./mpfr-2.4.2 ./gcc-4.6.2/mpfr $ mv ./gmp-4.3.2 ./gcc-4.6.2/gmp
create the object and install directories:
$ mkdir gcc-objdir $ mkdir glibc-objdir $ mkdir gcc-install $ mkdir glibc-install
compile gcc with mpc, mpfr and gmp:
$ cd ~/bin/gcc-objdir/ $ ../gcc-4.6.2/configure --prefix=/home/facultystaff2/wkim06/bin/gcc-install/ $ make $ make install
compile glibc:
$ cd ~/bin/glibc-objdir/ $ ../glibc-2.14/configure --prefix=/home/facultystaff2/wkim06/bin/glibc-install/ $ make $ make install
To run the program:
$ export LD_LIBRARY_PATH='/home/facultystaff2/wkim06/bin/glibc-install/lib/;/home/facultystaff2/wkim06/bin/gcc-install/lib64/' $ tcsh $ cd test-buckling $ ./install ...