Install GCC 4.6 on Fedora 12
For some reason, I have to install GCC 4.6 on a Fedora 12 server in the department (sadly that I can’t wipe it out and reinstall a latest version of Ubuntu).
I believe the following steps [1] are similar in other versions of Fedora or CentOS.
First, install necessary libraries:
1 |
sudo yum install gcc mpfr-devel libmpc libmpc-devel glibc-devel |
Then download the source code, configure, make and install,
1 2 3 4 5 6 7 8 9 10 |
cd ~ mkdir build-gcc cd build-gcc wget ftp://ftp.dti.ad.jp/pub/lang/gcc/releases/gcc-4.6.3/gcc-4.6.3.tar.gz # download gcc source tar xzvf gcc-4.6.3.tar.gz mkdir build cd build ../gcc-4.6.3/configure --program-suffix=-4.6 --enable-languages=c,c++ make sudo make install |
The GCC will be installed under /usr/local
. You can change the install dir by adding --prefix=PATH_TO_INSTALL_DIR
on configuration command.
To use GCC 4.6 in cmake, set CC=gcc-4.6
and CXX=g++-4.6
.
You may encounter a fatal error: gnu/stubs-32.h: No such file or directory
. [2]
This error message shows up on the 64 bit systems where GCC/UPC multilib feature is enabled, and it indicates that 32 bit version of libc is not installed. There are two ways to correct this problem:
- Install 32 bit version of glibc (e.g. glibc-devel.i686 on Fedora, CentOS, ..)
- Disable ‘multilib’ build by supplying “–disable-multilib” switch on the compiler configuration command