LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-13-2007, 09:55 AM   #1
Denisius
Member
 
Registered: Aug 2007
Location: Israel
Distribution: Slackware
Posts: 66

Rep: Reputation: 15
Multiple versions of GCC


How can i have 2 versions of GCC?
 
Old 11-13-2007, 10:00 AM   #2
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&14.1
Posts: 119

Rep: Reputation: 15
By changing your search path to the one you want to engage.

John
 
Old 11-13-2007, 10:01 AM   #3
Denisius
Member
 
Registered: Aug 2007
Location: Israel
Distribution: Slackware
Posts: 66

Original Poster
Rep: Reputation: 15
How do i do that?
 
Old 11-13-2007, 10:16 AM   #4
duryodhan
Senior Member
 
Registered: Oct 2006
Distribution: Slackware 12 Kernel 2.6.24 - probably upgraded by now
Posts: 1,054

Rep: Reputation: 46
export PATH=$PATH:<new_directory>

e.g export PATH=$PATH:/opt/gcc/bin/

run this in bash / put in bashrc.
 
Old 11-13-2007, 10:19 AM   #5
Denisius
Member
 
Registered: Aug 2007
Location: Israel
Distribution: Slackware
Posts: 66

Original Poster
Rep: Reputation: 15
Do i build the other(older) GCC first?
 
Old 11-13-2007, 10:39 AM   #6
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Re: Multiple versions of GCC

Quote:
Originally Posted by Denisius View Post
Do i build the other(older) GCC first?
Please give us more detail on what you are trying to accomplish so we can help you better.

For example: "I need gcc 2.95 and gcc 3.4.3 installed on the same machine. How do I do this?"
 
Old 11-13-2007, 10:57 AM   #7
Denisius
Member
 
Registered: Aug 2007
Location: Israel
Distribution: Slackware
Posts: 66

Original Poster
Rep: Reputation: 15
Well, i already have the newest GCC installed on my machine, but i need an older version one installed as well, 3.3.6.
 
Old 11-13-2007, 11:05 AM   #8
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Re: Multiple versions of GCC

Quote:
Originally Posted by Denisius View Post
Well, i already have the newest GCC installed on my machine, but i need an older version one installed as well, 3.3.6.
If you are building the older version from source, run configure with a prefix setting, e.g.
Code:
    # ./configure --prefix=/opt
    # make
    # make install
and it will be installed in /opt/bin instead of /usr/bin.

Then you can access the compiler directly using
Code:
    # /opt/bin/gcc
or by prefixing your path
Code:
    # export PATH=/opt/bin:$PATH
    # which gcc
    /opt/bin/gcc
 
Old 11-13-2007, 11:46 AM   #9
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Check out this earlier thread ... I too wanted to know how it can be done:
http://www.linuxquestions.org/questi...of-gcc-594814/

I used gnashley's package, still here:
http://distro.ibiblio.org/pub/linux/...vel/gcc-3.4.6/
 
Old 11-14-2007, 03:02 PM   #10
Denisius
Member
 
Registered: Aug 2007
Location: Israel
Distribution: Slackware
Posts: 66

Original Poster
Rep: Reputation: 15
When i compile it, it gives me a lot of warnings. Is that so for everyone?
 
Old 11-14-2007, 03:13 PM   #11
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Maybe this package can help you out: http://www.slackware.com/~alien/slackbuilds/gcc34/

It installs gcc 3.4.x alongside (i.e. not overwriting) the gcc 4.x of Slackware 12.0. The original gcc 4.x compiler will still be default but applications that specifically look for a gcc3 compiler (such as QEMU) will find and use the gcc3 compiler.

My notes on how to invoke the gcc3 compiler instead of the default gcc4:

Code:
# This is a gcc34 compatibility SlackBuild for use in Slackware > 11.0 ,
# where gcc4 is the default compiler suite.
# This gcc34 build installs to /usr/gcc34 and will not interfere with gcc4.
# *** Use gcc34 in your scripts, as follows ***
# * By using environment variables:
#   Most softwares support the CC and CXX environment variables.
#   First assign them, then run configure and/or make. Example:
#     CC=gcc34 CXX=g++34 ./configure
#
# * Using configure support:
#   If the software is using the standard GNU automake and configure,
#   then there is a chance it supports other compilers by passing in
#   a setting to the configure script.
#   First run configure --help to see if it mentions anything.
#   The following example is from MPlayer:
#     ./configure --help
#     ./configure --cc=gcc34
Eric
 
Old 11-15-2007, 07:39 AM   #12
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by David1357 View Post
If you are building the older version from source, run configure with a prefix setting, e.g.
Code:
    # ./configure --prefix=/opt
    # make
    # make install
and it will be installed in /opt/bin instead of /usr/bin.

Then you can access the compiler directly using
Code:
    # /opt/bin/gcc
or by prefixing your path
Code:
    # export PATH=/opt/bin:$PATH
    # which gcc
    /opt/bin/gcc
I should have also added that you need to modify your library path to point to /opt/lib; however, other posters seem to have handled this links to the other thread.
 
  


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
gcc versions compatibility with kernel versions.. mahesh_manthapuri SUSE / openSUSE 1 03-22-2006 12:28 AM
switching between gcc versions DrAMac Debian 2 08-30-2005 05:21 PM
multiple versions of gcc Avatar33 Linux - General 3 02-22-2005 02:06 PM
Can you have two different versions of gcc on the same system? the theorist Linux - Software 1 02-23-2004 04:53 PM
multiple gcc versions and selectability tincat2 Linux - Software 1 06-08-2003 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:35 AM.

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