LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-15-2012, 01:48 AM   #1
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Rep: Reputation: Disabled
Question How to install all g++ versions & switch 4.5,4.6,4.7 in Debian Wheezy? -alternatives?


As I was told Debian Wheezy provides 4 g++ instalations.

When i had apt-get install g++ only g++4.7 was installed

How can i install the former 3 also?

Does that -alternatives command i cought around has something to do with?

Or it to late now that my 1st intalation was the latest g++ 4.7?
 
Old 07-15-2012, 03:02 AM   #2
John VV
Guru
 
Registered: Aug 2005
Posts: 12,899

Rep: Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713Reputation: 1713
the different versions will be in the repos BUT under a slightly different name

just do a search for gcc and the others WILL be on the list



to use "alternatives" or to not use "alternatives" that is the question ....

some like it i do not
in /usr/bin there should be a link from /usr/bin/g++4.7 to /usr/bin/g++
or what ever the default it

i use a set up script
YOURS WILL BE A BIT DIFFERENT depending on just WHAT you have installed
-- my gcc 4.6 script called " set_gcc_to_4.6.sh" ---
Code:
#!/bin/bash
rm /usr/bin/cpp
ln -s /usr/bin/cpp-4.6 /usr/bin/cpp
echo ln -s cpp-4.6 cpp

rm /usr/bin/gcc
ln -s /usr/bin/gcc-4.6 /usr/bin/gcc
echo ln -s gcc-4.6 gcc

rm /usr/bin/cc
ln -s /usr/bin/gcc-4.6 /usr/bin/cc
echo ln -s gcc-4.6 cc

rm /usr/bin/g++
ln -s /usr/bin/g++-4.6 /usr/bin/g++
echo ln -s g++-4.6 g++

rm /usr/bin/c++
ln -s /usr/bin/g++-4.6 /usr/bin/c++
echo ln -s g++-4.6 c++

rm /usr/bin/gcov
ln -s /usr/bin/gcov-4.6 /usr/bin/gcov
echo ln -s gcov-4.6 gcov
use one for EVERY version
and edit the linking and removing to YOUR system

then as root run the script for the one you want

you will find that most software will need a bit of help to build in gcc4.7
it is SO NEW that most things have not caught up to it yet

4.5 is most likely the version you will most use

Last edited by John VV; 07-15-2012 at 03:07 AM.
 
Old 07-15-2012, 03:14 AM   #3
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
omg starts becoming complex :S
I'm a beginner to linux and stuck when comes to commands.
I would like to have what commands exactly shall i write line by line to have eg g++4.5 also installed

But afraiding of asking to much, if I can't figure further myself I may give it away

P.S.
However The -alternatives way i had cought somewhere appeared easier, no?
 
Old 07-15-2012, 03:22 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,622

Rep: Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527
Quote:
When I had apt-get install g++ only g++4.7 was installed
Yes, g++ is g++ version 4.7.

# apt-get install g++-4.4 g++-4.5 g++-4.6
... will install the other.

About using : You have been told that information in another post.
Example : # update-alternatives --config gcc
And of course the temporary export command :
export CC=gcc-4.4 CXX=g++-4.4 && <other-command>
etc. etc.

And please use # 'apt-cache search <name>' ( or part of name )
when you are searching for packages. ( apt-cache search g++ ).
Synaptic will show all versions too. ( # apt-get install synaptic ).

.

Last edited by knudfl; 07-15-2012 at 03:25 AM.
 
Old 07-15-2012, 04:16 AM   #5
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
So 1st i install the other versions

and 2nd i create the alternatives.
 
Old 07-15-2012, 05:44 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,622

Rep: Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527
Quote:
and 2nd i create the alternatives.
There seem to be no gcc entries in the Wheezy /etc/alternatives.

For daily use it's also much faster to rely on the temporary export commands.
 
  


Reply


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
[SOLVED] How can I switch between g++ 4.5 4.6 4.7 versions in Debian Squeeze? (6.0.5) esgol Linux - Newbie 2 07-13-2012 03:35 AM
[SOLVED] Newly installed debian sid & saved debian wheezy home would like to transfer files EDDY1 Linux - Newbie 11 01-20-2012 07:43 PM
LXer: Debian to offer MultiArch support with Debian Wheezy 7 in 2013 LXer Syndicated Linux News 0 08-11-2011 01:50 AM
LXer: Debian looking at a June 2012 freeze for Debian Wheezy LXer Syndicated Linux News 0 08-10-2011 10:00 AM
How do I sanely install & keep 2 concurrent versions of gcc ? H_TeXMeX_H Slackware 18 01-23-2008 10:51 AM


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