LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 02: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, 04:02 AM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,643

Rep: Reputation: 2653Reputation: 2653Reputation: 2653Reputation: 2653Reputation: 2653Reputation: 2653Reputation: 2653Reputation: 2653Reputation: 2653Reputation: 2653Reputation: 2653
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 04:07 AM.
 
Old 07-15-2012, 04:14 AM   #3
esgol
Member
 
Registered: Jul 2012
Posts: 106

Original Poster
Blog Entries: 1

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, 04:22 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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 04:25 AM.
 
Old 07-15-2012, 05:16 AM   #5
esgol
Member
 
Registered: Jul 2012
Posts: 106

Original Poster
Blog Entries: 1

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

and 2nd i create the alternatives.
 
Old 07-15-2012, 06:44 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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 04:35 AM
[SOLVED] Newly installed debian sid & saved debian wheezy home would like to transfer files EDDY1 Linux - Newbie 11 01-20-2012 08:43 PM
LXer: Debian to offer MultiArch support with Debian Wheezy 7 in 2013 LXer Syndicated Linux News 0 08-11-2011 02:50 AM
LXer: Debian looking at a June 2012 freeze for Debian Wheezy LXer Syndicated Linux News 0 08-10-2011 11:00 AM
How do I sanely install & keep 2 concurrent versions of gcc ? H_TeXMeX_H Slackware 18 01-23-2008 11:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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