[SOLVED] Compiling newer version of gcc separately
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
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.
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.
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.
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?
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.
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..
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.
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.