LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 04-09-2011, 02:18 PM   #1
albertkao
LQ Newbie
 
Registered: Jan 2010
Posts: 13

Rep: Reputation: 0
install multiple versions of GCC on Fedora 12


How to install multiple versions of GCC on Fedora 12?
Using yum, I upgraded my g++ to 4.4.4-10.
I want to install a second version 4.6.0 of GCC.

Gcc FAQ (http://gcc.gnu.org/faq.html#multiple) suggests that downloading the gcc source, then configure & compile it.
Is there an easier way?
e.g. using yum to install a second version.

$ g++ -v
Using built-in specs.
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC)
 
Old 04-09-2011, 02:21 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
You could try the testing repositories, but if the version you are looking for is not in there, then you will need to compile from source.

Josh
 
Old 04-09-2011, 02:57 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
You can have as many gcc versions, as you want, installed at the same time.

cd build-gcc/ &&
../gcc-4.6.0/configure --prefix=/usr/local/gcc460/ --etc. can be used.

It is not a good idea to replace the default version.
Also : Please have a look at one of the extra compilers :
# yum install compat-gcc-34-c++
 
Old 04-09-2011, 03:00 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by knudfl View Post
You can have as many gcc versions, as you want, installed at the same time.

cd build-gcc/ &&
../gcc-4.6.0/configure --prefix=/usr/local/gcc460/ --etc. can be used.

It is not a good idea to replace the default version.
Also : Please have a look at one of the extra compilers :
# yum install compat-gcc-34-c++
To extend what knudfl said... If you do use a different prefix, even placing that directory within your path you will have to use the full path name to that specific version of gcc if you have different versions installed.
 
Old 04-09-2011, 03:25 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
Quote:
If you do use a different prefix, even placing that directory within your path
No, not required. Will disturb more, than it do good.

Some links : gcc46, g++46 to /usr/bin/ will do.
( From /usr/local/gcc460/bin/gcc : g++ ).
An extra compiler is basically used with :
'export CC=gcc46 CXX=g++46 && ./configure'
 
Old 04-09-2011, 03:42 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by knudfl View Post
No, not required. Will disturb more, than it do good.

Some links : gcc46, g++46 to /usr/bin/ will do.
( From /usr/local/gcc460/bin/gcc : g++ ).
An extra compiler is basically used with :
'export CC=gcc46 CXX=g++46 && ./configure'
True... Technically, you could do it both ways.
 
Old 04-09-2011, 06:06 PM   #7
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
Quote:
True... Technically, you could do it both ways.
Setting a PATH : Will only work, if you only have one file by name gcc
and one g++ on the OS.
All other must then be build to create only gcc<version> and g++<version>.
Example :
The Slackware gcc34-3.4.6-<arch>-2compat, gcc34-g++34-3.4.6-<arch>-2compat
http://connie.slackware.com/~alien/slackbuilds/gcc34/
>> /usr/gcc34/bin/gcc34 : g++34

The script 'gcc34.SlackBuild' can actually be used to build other versions.
( Can easily be edited to do so.)
http://connie.slackware.com/~alien/s...s/gcc34/build/
 
Old 04-09-2011, 09:31 PM   #8
albertkao
LQ Newbie
 
Registered: Jan 2010
Posts: 13

Original Poster
Rep: Reputation: 0
I downloaded the gcc 4.6.0 source files and unzip them.
I have the following error.
I find the gmp, mpfr files but not mpc.
$ ../configure -prefix=/usr/local/gcc460
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
 
Old 04-10-2011, 01:39 AM   #9
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
albertkao a question
WHY are you doing this on the END OF LIFE - no longer supported fedora 12 ????

please STAY current if you are going to use fedora
and install fedora 14
gcc 4.6 will be in the repos ( or in the testing repo)
 
Old 04-10-2011, 07:47 AM   #10
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
Basics : 1) # yum install cloog-ppl-devel ( probably, I'm not sure it's used.)
# yum install mpc-devel
2) GCC must have a build folder outside the source, and the gmp/ mpfr/ mpc/
source packed out inside the gcc source.

tar xvf gcc-4.6.0.tar.bz2 && cd gcc-4.6.0/ && tar xvf gmp-4.3.2.tar.bz2 &&
tar xvf mpfr-2.4.2.tar.bz2 && tar xvf mpc-0.9.tar.bz2 && mv gmp* gmp &&
mv mpfr* mpfr && mv mpc* mpc && cd ../ && mkdir build-gcc && cd build-gcc/ &&

../gcc-4.6.0/configure --prefix=/usr/local/gcc460 --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

&& make : No errors.

..

Last edited by knudfl; 04-10-2011 at 07:49 AM.
 
Old 09-20-2011, 06:22 AM   #11
giridhart
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Rep: Reputation: Disabled
Hi,

I'm able to build gcc-4.5.2 on AMD x86_64 Debian machine.
But the problem is it only built 64 bit version of gcc, it is unable to build 32 bit applications.

when I tried ‘-m32′ options I’m getting this message /usr/bin/ld: skipping incompatible /usr/local/gcc452/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc /usr/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit statu What should I do to build gcc properly.

How can I solve this problem?

Regards
 
Old 09-20-2011, 06:11 PM   #12
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by giridhart View Post
Hi,

I'm able to build gcc-4.5.2 on AMD x86_64 Debian machine.
But the problem is it only built 64 bit version of gcc, it is unable to build 32 bit applications.

when I tried ‘-m32′ options I’m getting this message /usr/bin/ld: skipping incompatible /usr/local/gcc452/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc /usr/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit statu What should I do to build gcc properly.

How can I solve this problem?

Regards
Hello,

Please don't thread jack old threads; Please search these forums for a relevant answer, and if you can not find one, then go ahead and create a new thread.

Cheers,

Josh
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple gcc versions? Zeno McDohl Linux - Server 17 01-12-2009 06:40 AM
Having multiple versions of GCC Rostfrei Programming 4 11-21-2007 01:10 AM
Multiple versions of GCC Denisius Slackware 11 11-15-2007 07:39 AM
multiple versions of gcc Avatar33 Linux - General 3 02-22-2005 02:06 PM
multiple gcc versions and selectability tincat2 Linux - Software 1 06-08-2003 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:59 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