2013年1月24日星期四
Compile gcc-4.1.2 on Ubuntu 12.04 64bit
Compile gcc-4.1.2 on Ubuntu 12.04 64bit
ftp://ftp.gnu.org/gnu/gcc/gcc-4.1.2/
Create a folder where to build the gcc version
mkdir ~/gcc412
Extract the downloaded gcc release to that folder
tar -C ~/gcc412/ -xzvf /path/to/the/file/gcc-4.1.2.tar.gz
Make a build folder:
mkdir ~/gcc412/gcc-build/
At this stage we should be ready to build but first we need to be sure that we've got all the dependencies needed to compile. We need the linux-headers gcc-multilib, zlib1g, zlib1g-dev, zlibc
sudo apt-get install linux-headers-$(uname -r) gcc-multilib zlib1g zlib1g-dev zlibc
Then we need also to fix some file in the gcc folder.
First of all you need to edit the file ~/gcc412/gcc-4.1.2/gcc/config/i386/t-linux64.
At line 9 you should find:
MULTILIB_OSDIRNAMES = ../lib64 ../lib
You need to modify it as follows:
MULTILIB_OSDIRNAMES = ../lib64 ../lib32
Open the file ~/gcc412/gcc-4.1.2/libstdc++-v3/configure and at line 8284 replace:
sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
with:
sed -e 's/GNU ld (GNU Binutils for Ubuntu) \([0-9.][0-9.]*\).*/\1/'`
Last thing to do is to link some library otherwise the compiler won't find it.
cd /usr/lib
sudo ln -s x86_64-linux-gnu/crt1.o crt1.o
sudo ln -s x86_64-linux-gnu/crti.o crti.o
sudo ln -s x86_64-linux-gnu/crtn.o crtn.o
At this point we are ready to compile gcc.
Go in the build folder:
cd ~/gcc412/gcc-build
run the configure as autodesk suggests:
../configure --prefix=/opt/gcc412 --program-suffix=412 --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --disable-libunwind-exceptions --enable-__cxa_atexit --enable-languages=c,c++
and then compile it:
make -j 2 bootstrap MAKEINFO=makeinfo
As soon as the compiling process ends without throwing errors you will be able to run:
sudo make install
訂閱:
發佈留言 (Atom)
沒有留言:
發佈留言