Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Switch default C/C++ compiler
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
HWJ
n00b
n00b


Joined: 09 Oct 2007
Posts: 5
Location: RWTH-Aachen University

PostPosted: Tue Oct 09, 2007 11:24 am    Post subject: Switch default C/C++ compiler Reply with quote

Hi,
my GenToo system is running happily with gcc-4.1.2 being the default C/C++ compiler.
I have install gcc-4.2.1 and followed the advice of
http://www.gentoo.org/doc/en/gcc-upgrading.xml, i.e.
gcc-config i686-pc-linux-gnu-4.2.1
env-update && source /etc/profile
emerge --oneshot -av libtool

As root (only)
gcc -v shows the new version, but
strangely, gcc-config -l still shows the old version
and even if I build a small test program as root
ldd a.out
shows
libstdc++.so.6 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libstdc++.so.6 (0xb7ea9000)
^^^^
i.e. the old libraries are used.
And for non-root users, gcc -v shows the old version.

How can I make gcc-4.2.1 the default compiler for all users.
Has libstdc++ to be rebuilt?

Many thanks for some hints or pointers,
Helmut.
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5909

PostPosted: Tue Oct 09, 2007 11:25 am    Post subject: Reply with quote

More suited to P+P, so moving there.

Moved from Installing Gentoo to Portage & Programming.
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017
Back to top
View user's profile Send private message
To
Veteran
Veteran


Joined: 12 Apr 2003
Posts: 1145
Location: Coimbra, Portugal

PostPosted: Tue Oct 09, 2007 1:10 pm    Post subject: Reply with quote

On the list from the gcc-config -l command, use gcc-config NUMBER, where number will the number before the gcc version you want.
_________________

------------------------------------------------
Linux Gandalf 3.2.35-grsec
Gentoo Base System version 2.2
------------------------------------------------
Back to top
View user's profile Send private message
gigs94
n00b
n00b


Joined: 06 Aug 2004
Posts: 52
Location: DC

PostPosted: Tue Oct 09, 2007 2:17 pm    Post subject: Reply with quote

I have the same issue:

Code:
# gcc-config -l
 [1] x86_64-pc-linux-gnu-4.1.2 *
 [2] x86_64-pc-linux-gnu-4.2.1

# gcc-config 2
 * Switching native-compiler to x86_64-pc-linux-gnu-4.2.1 ...                                                                                           [ ok ]

# env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...

# gcc -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libunwind-exceptions --enable-multilib --enable-libmudflap --disable-libssp --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.2 (Gentoo 4.1.2)
Back to top
View user's profile Send private message
HWJ
n00b
n00b


Joined: 09 Oct 2007
Posts: 5
Location: RWTH-Aachen University

PostPosted: Tue Oct 09, 2007 2:28 pm    Post subject: Reply with quote

To wrote:
On the list from the gcc-config -l command, use gcc-config NUMBER, where number will the number before the gcc version you want.

Doesn't work:
gcc-config -l
[1] i686-pc-linux-gnu-4.1.2 *
[2] i686-pc-linux-gnu-4.2.1
2 # gcc-config 2
* Switching native-compiler to i686-pc-linux-gnu-4.2.1 ... [ ok ]
3 # gcc-config -l
[1] i686-pc-linux-gnu-4.1.2 *
[2] i686-pc-linux-gnu-4.2.1
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Tue Oct 09, 2007 2:47 pm    Post subject: Reply with quote

I just tried this. I installed gcc-4.1.2 and checked gcc -v then selected gcc-config i686-pc-linux-gnu-4.1.2 then env-update && . /etc/profile. In the xterm that I installed in
Code:
gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.2 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-nls --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libunwind-exceptions --disable-multilib --enable-libmudflap --disable-libssp --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.2 (Gentoo 4.1.2)


In another xterm I had opened before the switch, I did env-updated and . /etc/profile it showed the switch. I opened another xterm and it showed the correct info, gcc-4.1.2.

Did you guys run " env-update && . /etc/profile " :?:
_________________
An A-Z Index of the Linux BASH command line
Back to top
View user's profile Send private message
HWJ
n00b
n00b


Joined: 09 Oct 2007
Posts: 5
Location: RWTH-Aachen University

PostPosted: Tue Oct 09, 2007 3:14 pm    Post subject: Reply with quote

Of course I did
env-update && . /etc/profile

Just, it didn't help. Some time ago, when I upgraded to 4.1.2 I hadn't
any problems. But, upgrading to 4.2.1 does pose some problems.
Helmut.
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Tue Oct 09, 2007 4:10 pm    Post subject: Reply with quote

I'm using " sudo gcc-config -V >> gcc-config-1.4.0-r2 ". I was able to switch from 4.1.2 to 4.2.0 using either the # and/or the full " i686-pc-linux-gnu-4.2.0 ". I just went back to gcc-4.2.0 and after "source /etc/profile " gcc -v shows the correct info.
_________________
An A-Z Index of the Linux BASH command line
Back to top
View user's profile Send private message
HWJ
n00b
n00b


Joined: 09 Oct 2007
Posts: 5
Location: RWTH-Aachen University

PostPosted: Tue Oct 09, 2007 4:29 pm    Post subject: Reply with quote

Here sudo gcc-config -V gives gcc-config-1.4.0-r3.
And, to repeat, as ROOT (only)
gcc-config i686-pc-linux-gnu-4.2.1 (or just 2)
and then gcc -v gives version 4.2.1 but
gcc-config -l still attaches the star to version 4.1.2

and even worse, when running as non-root user
I always get gcc -v >> 4.1.2
i.e. I can't switch gcc for a non-root user.
Back to top
View user's profile Send private message
HWJ
n00b
n00b


Joined: 09 Oct 2007
Posts: 5
Location: RWTH-Aachen University

PostPosted: Tue Oct 09, 2007 4:49 pm    Post subject: Reply with quote

hielvc wrote:
I'm using " sudo gcc-config -V >> gcc-config-1.4.0-r2 ". I was able to switch from 4.1.2 to 4.2.0 using either the # and/or the full " i686-pc-linux-gnu-4.2.0 ". I just went back to gcc-4.2.0 and after "source /etc/profile " gcc -v shows the correct info.


I've just had a look at /etc/profile.env
export PATH='/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.1.1:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2:/usr/i686-pc-linux-gnu/gcc-bin/4.2.1:/opt/blackdown-jdk-1.4.2.03/bin:/opt/blackdown-jdk-1.4.2.03/jre/bin:/opt/dmd/bin:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/NX/bin:/usr/games/bin'

What part of protage updates this one. e.g. /usr/i686-pc-linux-gnu/gcc-bin/4.1.1 doesn't exist anymore and
/usr/i686-pc-linux-gnu/gcc-bin/4.1.2 occurs before
/usr/i686-pc-linux-gnu/gcc-bin/4.2.1:
which is probably the reason the wrong gcc is found first.
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Sat Oct 13, 2007 3:09 pm    Post subject: Reply with quote

HWJ You are totally correct. gcc-config-1.4.0-r3 is broken big time. I was testing a script last night that switchs your gcc and it worked fine -r2, but on this box with -r3 it says it does , but just as you pointed out, it just changes what gcc-config thinks and not the enviroment. It make a bogus "config-i686-pc-linux-gnu-4.1.2" in /etc/env.d/gcc/ DO you want to file the bug ? If so pleace paste the bug# here. Ill wait an hour or so then file it my self.
_________________
An A-Z Index of the Linux BASH command line
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Sat Oct 13, 2007 6:03 pm    Post subject: Reply with quote

I just emerged gcc-4.2.2 and was able to switch to it with gcc-config. New xterms pick up the change. I then tried changing back gcc-4.1.2
Quote:
gcc-config -l
[1] i686-pc-linux-gnu-4.1.2
[2] i686-pc-linux-gnu-4.2.2 *
amdually hielvc # gcc-config 1
* Switching native-compiler to i686-pc-linux-gnu-4.1.2 ... [ ok ]
amdually hielvc # gcc-config -l
[1] i686-pc-linux-gnu-4.1.2
[2] i686-pc-linux-gnu-4.2.2 *
amdually hielvc # gcc -v ... gcc version 4.2.2 (Gentoo 4.2.2 p1.0)

Running env-update && . /etc/profile has no effect. When thru I'm still at gcc-4.2.2.

Just filed bug 195727
_________________
An A-Z Index of the Linux BASH command line
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum