Building gcc 4.5.1
Building gcc isnt an easy task. I'm working on CentOS 5.5 and trying to build gcc 4.5.1. I built the preq libraries(gmp, mpc, mpfr) and binutils, all installed into the same directory(/opt/gcc-4.5.1). So I build gcc with the following configure options:
--with-mpc=/opt/gcc-4.5.1/ --with-gmp=/opt/gcc-4.5.1/ --with-mpfr=/opt/gcc-4.5.1/ --disable-shared --prefix=/opt/gcc-4.5.1/ --with-build-sysroot=/opt/gcc-4.5.1/ --with-build-time-tools=/opt/gcc-4.5.1/bin/ Note: I tried before without the disable-shared(which is used with all preq's) and would get an error about libgcc not finding the mpc library. So adding that option gets me farther but here is where I'm stuck: Quote:
|
The build of gcc-4.5.1 is well documented, and LQ members are building it all the time.
Most often as part of LFS http://www.linuxfromscratch.org/lfs/ > > LFS-BOOK-6.7 http://www.linuxfromscratch.org/lfs/downloads/stable/ From my notes, CentOS 5.5 / Scientific Linux SL55 : Unpack gmp, mpfr, mpc into gcc-4.5.1/ and rename them to gmp/ mpfr/ mpc/ . Go to the build directory outside gcc-4.5.1/ , and do ../gcc-4.5.1/configure --prefix=/usr/local/gcc451 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --disable-multilib --with-system-zlib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs Requirements, probably # yum install \ gcc-g++ binutils-devel elfutils-libelf-devel glibc-devel ( You seem to be missing glibc-devel ? ). make : No errors. P.S. : /root/ should not be used for compiling. /root/ is not meant to be used for anything. Default is /home/<name>/tmp/ or any other folder in /home/<name>/. .. |
Linux from scratch is a good guide, but I finally got things working by using different versions of gmp and mpfr(4.3.2 and 2.4.2 respectively). Something about the latest versions being inserted into the gcc tree and they don't build write(mpfr cant find gmp). I did try building them outside the gcc tree and telling configure where they were, but then there were linking problems.
So downloaded gcc-4.5.1, untar, inserted gmp/mpfr/mpc and used configure --prefix=/opt/gcc-4.5.1 No other special build options and it works. Takes a long long LONG time but it works. I do run 'make -k check' but that test_summery command doesn't give any output? |
I should also mention I'm building it a little closer to the guide. I first built gcc-4.3 in the manner I described before and used that to build binutils and glibc into a directory /opt/gcc-4.5.1-ver2 and configured gcc with the following:
--prefix=/opt/gcc-4.5.1-ver2 --enable-languages=c,c++,fortran --enable-threads=posix --enable-shared --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-bootstrap --with-system-zlib --with-build-time-tools=/opt/gcc-4.5.1-ver2/bin --with-build-sysroot=/opt/gcc-4.5.1-ver2/ --with-sysroot=/opt/gcc-4.5.1-ver2/ Its building right now and I'll report how it turns out. Another question would be how would I setup a build environment that used /opt/gcc-4.5.1-ver2 instead of any of their lesser version numbered system programs? Simple as setting the PATH? Or what about LD_LIBRARY_PATH/LD_RUN_PATH? I'm fairly certain that I should go adding this to /etc/ld.so.conf since they are different from the system version. |
Lets start with the three default gcc for CentOS 5.5 :
# yum install g++ gcc44-c++ compat-gcc-34-c++ .. which will provide gcc-4.1.2 ( you already have it ) and gcc-4.4.0 , gcc-3.4.6 . Using e.g. gcc-3.4.6 : 1) export CC=gcc34 CXX=g++34 2) <other command> Gcc-4.5.1 cannot be added to your path : gcc is named 'gcc'. The simple way of using it ( except for the full path ) is : cd /usr/bin/ # ln -s /opt/gcc-4.5.1/bin/gcc gcc451 # ln -s /opt/gcc-4.5.1/bin/g++ g++451 GCC will usually know, where its own files are located. 'export CC=gcc451 CXX=g++451' should then be sufficient. And you don't need a later binutils. 2.17.50 is OK. Neither do you need another glibc. Using anything different from glibc-2.5 will just make the compiled results rather useless on CentOS. No glibc libraries can ever be added to your path. The OS will stop working. Immediately. .. |
hi
i tried everyting....but same error has come........ |
ksp009 , post # 6.
Please ask / answer in your own thread : http://www.linuxquestions.org/questi...1/#post4192213 Did you read the two latest posts there ? ( #9 and #10 ). .. |
All times are GMT -5. The time now is 09:30 PM. |