LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-30-2012, 09:33 AM   #1
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Rep: Reputation: 0
Compiling newer version of gcc separately


Hi,
I want to compile a new version gcc but i dont want to upgrade the previous version. I want to have both the version available on my system. I understand that compiling gcc is the only way, since there wont be any binaries for gcc available. Am i right?

I have started compiling it anyway, and i have some doubts (rather many!).

The way which i am doing now is have 3 dirs

srcdir - For all the extracted source codes
objdir - Where i actually configure an do a make
sysroot - Where i install, using prefix option

So the order is,

1. gmp
2. mpfr with the new gmp
3. mpc with the new gmp,mpfr

After this i get a good looking bin,lib,share folders in my sysroot.

4. binutils with the new gmp,mpfr,mpc

But after this step i get more folders lib64,x86-64-unknown-linux. What is this x86-64-unknown-linux? why does it have a bin and a lib again?

Is these steps correct?

And my question is will this use all my older system header files? should i install a new linux kernel header files as well, so that it is perfectly updated?

5. gcc - with the new gmp,mpfr,mpc,ld,as,sys-root

This is throwing me an error stating system include files is not present in the sysroot/usr/include

So what am i doing wrong here, or what have i missed here.

Thanks in advance.
 
Old 03-30-2012, 09:46 AM   #2
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
In the last step (5th step) without --sys-root option it says

configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
 
Old 03-30-2012, 12:54 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Might be simpler than you imagine.
First : Usually more than one compiler is available in your 'Package Manager',
and can be installed. Which Linux OS are you using ? ?

All gcc versions 3.2.3 .. 4.7 can be compiled. And: gcc uses no kernel files.

Example 4.5, post #2 here
http://www.linuxquestions.org/questi...-1-a-842567/#2

4.6 , post #8 here
http://www.linuxquestions.org/questi...hine-929660/#8

No gmp, mpfr, mpc needs to be installed, as you can see from the examples.
"x86-64-unknown-linux" : No OS was specified.
.
 
Old 03-30-2012, 01:45 PM   #4
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by knudfl View Post
Might be simpler than you imagine.
First : Usually more than one compiler is available in your 'Package Manager',
and can be installed. Which Linux OS are you using ? ?

All gcc versions 3.2.3 .. 4.7 can be compiled. And: gcc uses no kernel files.

Example 4.5, post #2 here
http://www.linuxquestions.org/questi...-1-a-842567/#2

4.6 , post #8 here
http://www.linuxquestions.org/questi...hine-929660/#8

No gmp, mpfr, mpc needs to be installed, as you can see from the examples.
"x86-64-unknown-linux" : No OS was specified.
.
Thanks for your reply. Its really good to know that i am some what in correct direction.

I am running Fedora 14, i am trying to build gcc-4.7

I tried putting mpc, mpfr, gmp (the latest versions) inside the gcc folder but it dint work out for me, that is why i went to this option.

So i need to have the following pre-requisites:
1.mpc
2.mpfr
3.gmp
4.gcc-g++
5.binutils-devel
6.glibc-devel
7.elfutils-libelf-devel

I have the first 3 but for the next 4, i cannot do a yum install. I have to transfer it to this machine and do it.
So i have to download rpm's of it and install it manually.

But could you please guide me for the location where i have to install these packages? can i put them under gcc source directory will it be built by itself?

And if can provide download locations it will be so helpful. If u cannot never mind, i will find it.
 
Old 03-30-2012, 01:53 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
OK, gcc-4.7 : An example here
http://nosemaj.org/debian-gcc-4-7

Ref. http://www.linuxquestions.org/questi...eeze-936581/#3
 
Old 03-30-2012, 02:07 PM   #6
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by knudfl View Post
So i dont need to build glibc-devel or binutils-devel??
Will that work?? Anyways trying it out now..
But if the glibc is not updated will my gcc be up to date?
 
Old 03-30-2012, 03:17 PM   #7
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
I followed the example link you mentioned, Everything worked fine until the make of gcc.

It throws me this error message -

/usr/lib/../lib/crti.o: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status


this crti.o is a symlink to the one in /usr/lib64/crti.o
 
Old 03-30-2012, 04:18 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
fedora 14 is PAST it's END OF LIFE
there currently is NO support and there will NEVER be any support


install fedora 17 ( testing ONLY alpha/beta)

fedora 17 will have gcc 4.7 BY DEFAULT

or wait a few weeks for the official fedora 17 release
 
Old 03-30-2012, 10:29 PM   #9
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by John VV View Post
fedora 14 is PAST it's END OF LIFE
there currently is NO support and there will NEVER be any support


install fedora 17 ( testing ONLY alpha/beta)

fedora 17 will have gcc 4.7 BY DEFAULT

or wait a few weeks for the official fedora 17 release
OS is not a problem now, i am pretty much satisfied with what i have got now.
Even if i update to Fedora17, then in few months there would be an updated version of gcc which i would be needing. So i really need to figure out the way to compile different versions of gcc's.
 
Old 03-30-2012, 11:42 PM   #10
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
there is almost NO reason to update gcc past 4.3
MOST software will not even build in gcc 4.6 let alone 4.7

i ROUTINELY have to drop from gcc 4.5 to 4.3 or 4.1
and even sometimes 3.4
 
Old 03-31-2012, 12:31 AM   #11
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Red face

Quote:
Originally Posted by John VV View Post
there is almost NO reason to update gcc past 4.3
MOST software will not even build in gcc 4.6 let alone 4.7

i ROUTINELY have to drop from gcc 4.5 to 4.3 or 4.1
and even sometimes 3.4
I doing it on a system which has gcc 4.1 surprisingly. I would be even happy to compile 4.5 or even 4.3 as you said (though it seems to be an answer just for today). But my prob here is not with version, its about compiling gcc. If i can do one version properly then i would do as many as i want.

Quote:
/usr/lib/../lib/crti.o: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status

this crti.o is a symlink to the one in /usr/lib64/crti.o
Since it was just a symlink, i deleted it and tried make. Now it shows


/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

Guys please help me out, i am stuck with this for two full days now..
 
Old 03-31-2012, 01:35 AM   #12
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
you could backport the src.rpm from fedora 17 back to 14
from koji
http://koji.fedoraproject.org/koji/p...o?packageID=40
4.7.0
http://koji.fedoraproject.org/koji/b...buildID=308850


also you might want to have a look over at the
" End Of Life" section on fedoraforum
http://forums.fedoraforum.org/forumdisplay.php?f=75

and have a read ( it is old so you will NEED to update it )
and have a look at the links at the bottom of the page
http://www.mjmwired.net/resources/mjm-fedora-gcc.html

this is for building an older version of gcc on fedora 15
-- it is close --
http://dummdida.blogspot.com/2011/10...fedora-15.html



you WILL WANT to use "--program-suffix=-4.7.0 " in your configure line so you do not kill what is installed

then set up "alternatives " so you can move from 4.1 to 4.7


as to the error
you have installed the FULL development tools ? right ?
for a listing
Code:
su -
yum grouplist
there should be a development tools & development libraries
Code:
su -
yum groupinstall "Development Tools" "Development Libraries"
also for gcc
Code:
su -
yum install glibc-devel.i686 glibc-devel.x86_64  gmp-devel mpfr-devel

Last edited by John VV; 03-31-2012 at 01:41 AM.
 
1 members found this post helpful.
Old 03-31-2012, 02:29 AM   #13
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by John VV View Post
you could backport the src.rpm from fedora 17 back to 14
from koji
http://koji.fedoraproject.org/koji/p...o?packageID=40
4.7.0
http://koji.fedoraproject.org/koji/b...buildID=308850


also you might want to have a look over at the
" End Of Life" section on fedoraforum
http://forums.fedoraforum.org/forumdisplay.php?f=75

and have a read ( it is old so you will NEED to update it )
and have a look at the links at the bottom of the page
http://www.mjmwired.net/resources/mjm-fedora-gcc.html

this is for building an older version of gcc on fedora 15
-- it is close --
http://dummdida.blogspot.com/2011/10...fedora-15.html



you WILL WANT to use "--program-suffix=-4.7.0 " in your configure line so you do not kill what is installed

then set up "alternatives " so you can move from 4.1 to 4.7


as to the error
you have installed the FULL development tools ? right ?
for a listing
Code:
su -
yum grouplist
there should be a development tools & development libraries
Code:
su -
yum groupinstall "Development Tools" "Development Libraries"
also for gcc
Code:
su -
yum install glibc-devel.i686 glibc-devel.x86_64  gmp-devel mpfr-devel
Hi as i have said in the previous posts i cannot do a yum install. I have to install it manually.

No i dont have development packages or libraries installed. I was following this link.. http://nosemaj.org/debian-gcc-4-7

So how do i install glibc-devel and other development tools and libraries.
I have gmp,mpfr,mpc,ppl,cloog installed into a separate directory.
So i prefer installing all the other libraries needed also be installed into this directory.
 
Old 03-31-2012, 03:54 AM   #14
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
the fedora 14 repos are still there - nothing will be added, and in time they will disappear . But they are still up

you still can use "yum"

unless this fedora 14 box has no internet connection
and if you do not have a internet connection on that box -- it is going to be VERY hard to install anything

and WHY are you fallowing a DEBIAN tutorial for Fedora ???
that is like using a GM manual to fix your FORD car - it dose NOT work

though that link is fairly generic, except that fedora dose NOT use /usr/local
so you will need to install the REQUIRED development software
 
Old 03-31-2012, 05:13 AM   #15
mvairavan
Member
 
Registered: Feb 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by John VV View Post
the fedora 14 repos are still there - nothing will be added, and in time they will disappear . But they are still up

you still can use "yum"

unless this fedora 14 box has no internet connection
and if you do not have a internet connection on that box -- it is going to be VERY hard to install anything

and WHY are you fallowing a DEBIAN tutorial for Fedora ???
that is like using a GM manual to fix your FORD car - it dose NOT work

though that link is fairly generic, except that fedora dose NOT use /usr/local
so you will need to install the REQUIRED development software
I was following that tutorial because it simple and generic. I cannot do yum install because of no internet connection and i dont want to add any extra packages in the main system folders of that machine. I want this gcc to installed completely separately.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Assistance in compiling an old version of gcc with a newer one Ztif Linux - Newbie 2 07-01-2011 12:01 PM
Compiling a module separately without compiling entire kernel kushalkoolwal Linux - Kernel 8 08-06-2008 01:45 AM
one more error building GCC - related with the newer version of Glibc?? lfs63 Linux From Scratch 1 02-17-2008 09:20 AM
install or upgrade newer or older gcc version saistain Linux - Software 1 10-19-2007 10:26 PM
Newer version of glibc means i cant install gcc coop Red Hat 0 09-21-2003 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration