LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-05-2010, 10:52 AM   #1
Neruocomp
Member
 
Registered: Oct 2004
Distribution: Slackware, CentOS
Posts: 135

Rep: Reputation: 15
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:
make[4]: Entering directory `/root/workspace/gcc/gcc-4.5.1/BUILD/gcc-4.5.1/x86_64-unknown-linux-gnu/32/libgcc'
# If this is the top-level multilib, build all the other
# multilibs.
/root/workspace/gcc/gcc-4.5.1/BUILD/gcc-4.5.1/./gcc/xgcc -B/root/workspace/gcc/gcc-4.5.1/BUILD/gcc-4.5.1/./gcc/ -B/opt/gcc-4.5.1/x86_64-unknown-linux-gnu/bin/ -B/opt/gcc-4.5.1/x86_64-unknown-linux-gnu/lib/ -isystem /opt/gcc-4.5.1/x86_64-unknown-linux-gnu/include -isystem /opt/gcc-4.5.1/x86_64-unknown-linux-gnu/sys-include --sysroot=/opt/gcc-4.5.1/ -g -O2 -m32 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../.././gcc -I../../../../../libgcc -I../../../../../libgcc/. -I../../../../../libgcc/../gcc -I../../../../../libgcc/../include -I../../../../../libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../../../libgcc/../gcc/libgcc2.c \

In file included from ../../../../../libgcc/../gcc/libgcc2.c:29:0:
../../../../../libgcc/../gcc/tsystem.h:87:19: fatal error: stdio.h: No such file or directory
compilation terminated.
make[4]: *** [_muldi3.o] Error 1
make[4]: Leaving directory `/root/workspace/gcc/gcc-4.5.1/BUILD/gcc-4.5.1/x86_64-unknown-linux-gnu/32/libgcc'
make[3]: *** [multi-do] Error 1
make[3]: Leaving directory `/root/workspace/gcc/gcc-4.5.1/BUILD/gcc-4.5.1/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-multi] Error 2
make[2]: Leaving directory `/root/workspace/gcc/gcc-4.5.1/BUILD/gcc-4.5.1/x86_64-unknown-linux-gnu/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/root/workspace/gcc/gcc-4.5.1/BUILD/gcc-4.5.1'
make: *** [all] Error 2
 
Old 11-05-2010, 03:18 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,522

Rep: Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503
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>/.
..
 
Old 11-09-2010, 03:05 PM   #3
Neruocomp
Member
 
Registered: Oct 2004
Distribution: Slackware, CentOS
Posts: 135

Original Poster
Rep: Reputation: 15
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?
 
Old 11-09-2010, 03:19 PM   #4
Neruocomp
Member
 
Registered: Oct 2004
Distribution: Slackware, CentOS
Posts: 135

Original Poster
Rep: Reputation: 15
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.
 
Old 11-10-2010, 03:37 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,522

Rep: Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503
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.
..
 
Old 12-16-2010, 07:24 AM   #6
ksp009
LQ Newbie
 
Registered: Dec 2010
Posts: 19

Rep: Reputation: 0
hi

i tried everyting....but same error has come........
 
Old 12-16-2010, 07:53 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,522

Rep: Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503
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 ).

..
 
  


Reply

Tags
gcc451


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Building GCC 4.5.0 prushik Linux - Software 9 09-11-2010 06:38 AM
Building and Installing GCC t8rsalad Linux From Scratch 2 06-06-2009 05:51 AM
error in Building gcc-4.0.2 newcomer4 Linux - Software 2 01-31-2006 02:44 AM
building gcc under cygwins Laplace Linux - General 0 11-12-2003 01:40 AM
Building GCC natesch Linux - Newbie 4 05-09-2002 12:38 AM


All times are GMT -5. The time now is 09:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration