View previous topic :: View next topic |
Author |
Message |
dmitchell Veteran


Joined: 17 May 2003 Posts: 1159 Location: Austin, Texas
|
Posted: Fri Jun 10, 2005 6:54 pm Post subject: Help with slotted gcc |
|
|
I have both gcc-3.3.6 and gcc-3.4.4 installed and I'd like to use 3.4.4 to compile my personal projects while keeping gcc-3.3.6 selected as the system-wide default. How can I achieve this?
The output of gcc-config -l:
Code: | [1] i686-pc-linux-gnu-3.3.6 *
[2] i686-pc-linux-gnu-3.3.6-hardened
[3] i686-pc-linux-gnu-3.3.6-hardenednopie
[4] i686-pc-linux-gnu-3.3.6-hardenednopiessp
[5] i686-pc-linux-gnu-3.3.6-hardenednossp
[6] i686-pc-linux-gnu-3.4.4
[7] i686-pc-linux-gnu-3.4.4-hardened
[8] i686-pc-linux-gnu-3.4.4-hardenednopie
[9] i686-pc-linux-gnu-3.4.4-hardenednopiessp
[10] i686-pc-linux-gnu-3.4.4-hardenednossp |
Is it enough to export PATH="`gcc-config 6 -B`:${PATH}"? (I might use eval `gcc-config 6 -E` if it didn't add sbin directories to the path.)
Edit: The above seems to cause problems when linking against a library that uses libstdc++. In particular, a library built with gcc-3.3.6 is linked against libstdc++.so.5, but gcc-3.4.4 tries to link against libstdc++.so.6. An ld warning ensues. _________________ Your argument is invalid. |
|
Back to top |
|
 |
TheX Guru


Joined: 31 Jul 2004 Posts: 349 Location: .de
|
Posted: Fri Jun 10, 2005 9:58 pm Post subject: |
|
|
You can change between different gcc versions with
Code: |
hansa ~ # gcc-config -l
[1] i386-pc-linux-gnu-3.3.4
[2] i686-pc-linux-gnu-3.4.4 *
[3] i686-pc-linux-gnu-3.4.4-hardened
[4] i686-pc-linux-gnu-3.4.4-hardenednopie
[5] i686-pc-linux-gnu-3.4.4-hardenednopiessp
[6] i686-pc-linux-gnu-3.4.4-hardenednossp
hansa ~ # gcc-config -f i686-pc-linux-gnu-3.4.4
* Switching to i686-pc-linux-gnu-3.4.4 compiler ... [ ok ]
hansa ~ #
|
Maybe this could help 2:
https://forums.gentoo.org/viewtopic-t-318790-highlight-libstdc+la.html |
|
Back to top |
|
 |
dmitchell Veteran


Joined: 17 May 2003 Posts: 1159 Location: Austin, Texas
|
Posted: Fri Jun 10, 2005 10:32 pm Post subject: |
|
|
Thanks for the reply, but the effect of gcc-config is to change the system-wide default compiler.
I'm beginning to wonder if this is feasible at all, since it appears unsafe to use compiler X to link against libraries built with compiler Y. _________________ Your argument is invalid. |
|
Back to top |
|
 |
CMoH n00b


Joined: 08 Sep 2004 Posts: 27 Location: Timisoara, Romania
|
Posted: Fri Jun 10, 2005 10:40 pm Post subject: |
|
|
I don't have any experience at all with gcc-config and the system that portage/gcc-config developers imagined one could employ to use multiple versions of GCC on the same machine. <-- this was a disclaimer
However, I see that gcc-config also has a -L option which gives the PATH to the libraries used by the given config. I suppose using that path instead of the default compiler's path would show an improvement, since a ls there also shows libstdc++.
As a side-subject, it seems that gcc-config is underdocumented and its purpose, usage and/or internals are assumed by its developers to be prior knowledge to everybody else. (At least from google searches for "gcc-config"). It is not. Starting from this statement, I assume the main purpose of this gcc-config tool is to set a system compiler for the Gentoo distribution. From this point of view using it to handle development targeted for multiple GCC versions is a misuse. And its lack of handiness in doing that is also a hint towards this idea.
Am I assuming correctly? My previous experience with multiple GCC versions was to get those versions and bootstrap each one of them with different --suffix-es, next using CC and CXX etc. to set the needed one from my build scripts. Is there a better way on Gentoo? |
|
Back to top |
|
 |
Gentree Watchman


Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Sat Jun 11, 2005 8:50 am Post subject: |
|
|
Quote: | Edit: The above seems to cause problems when linking against a library that uses libstdc++. In particular, a library built with gcc-3.3.6 is linked against libstdc++.so.5, but gcc-3.4.4 tries to link against libstdc++.so.6. An ld warning ensues.
_________________ |
Yes I think you are likely to give youself big headaches if you try to mix pkg built with different compilers.
I switched from 3.3 to 3.4 about a year ago and saw no issues at all.
I never had any need for the fixlibtools script others seem to need , poss because I got it right doing it all at once and rebuilt the toolchain as required.
Code: | gcc-config -L
gcc-config [number from above]
emerge -e system && emerge -e system |
I would suggest a clean switch and a complete rebuild unless you have strong reasons for doing otherwise and understand the implications.
If it is just a case of treading carefully you're better off going the whole hog.
Once you have the system rebuilt , buy yourself a copy of the Dune triology and then run
emerge -e system
See you next week  _________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
 |
dmitchell Veteran


Joined: 17 May 2003 Posts: 1159 Location: Austin, Texas
|
Posted: Sat Jun 11, 2005 7:58 pm Post subject: |
|
|
Gentree wrote: | Yes I think you are likely to give youself big headaches if you try to mix pkg built with different compilers. |
Yes, but if my project needs gcc 3.4 to compile and it needs libfoo that was built with gcc 3.3, what am I to do? How can one test software with gcc X, Y, and Z when all the system libraries are built with X? _________________ Your argument is invalid. |
|
Back to top |
|
 |
Gentree Watchman


Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Sat Jun 11, 2005 8:50 pm Post subject: |
|
|
So you are saying that you want to test your software with different compilers because you want to release it as open source and you dont know what the target system will be, right?
Then you need to test it on what you deem to be the test target system.
If that is to include a system build on 3.4 you will need to make yourself a system that was build with 3.4 to test it on. Do yourself a stage1 installation on a spare partition and boot to it.
If that is not what you are doing please post exactly what you are trying to do rather than letting us guess and give you useless advice.
Hope it fits anyway.  _________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
 |
dmitchell Veteran


Joined: 17 May 2003 Posts: 1159 Location: Austin, Texas
|
Posted: Sat Jun 11, 2005 9:05 pm Post subject: |
|
|
I've written a scientific app that needs to run on a quad-Xeon Gentoo machine built with gcc-3.3. My application uses C++ template code that requires gcc-3.4; it also has to link against several libraries. I've installed gcc-3.4.4 on the quad-Xeon and--if possible--would like to be able to build my app there. _________________ Your argument is invalid. |
|
Back to top |
|
 |
Gentree Watchman


Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Sat Jun 11, 2005 9:32 pm Post subject: |
|
|
So why dont you just rebuild the target with the new compiler?
 _________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
 |
dmitchell Veteran


Joined: 17 May 2003 Posts: 1159 Location: Austin, Texas
|
Posted: Sat Jun 11, 2005 9:57 pm Post subject: |
|
|
If it were my quad-Xeon, I would. It's my boss' machine and he wants to keep it on the stable branch. Is it not possible to compile the app on the target? Is there no alternative to static compilation on a gcc-3.4 machine? _________________ Your argument is invalid. |
|
Back to top |
|
 |
Gentree Watchman


Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Sat Jun 11, 2005 10:24 pm Post subject: |
|
|
Code: | * sys-devel/gcc :
[M ] 2.95.3-r8 (2.95)
[M ] 2.95.3-r9 (2.95)
[M ] 3.1.1-r2 (3.1)
[M ] 3.2.2 (3.2)
[M ] 3.2.3-r4 (3.2)
[M ] 3.3.2 (3.3)
[M ] 3.3.2-r5 (3.3)
[M ] 3.3.2-r7 (3.3)
[ ] 3.3.5-r1 (3.3)
[M~ ] 3.3.5.20050130 (3.3)
[ ] 3.3.5.20050130-r1 (3.3)
[M~ ] 3.3.5.20050130-r2 (3.3)
[M~ ] 3.3.6 (3.3)
[M~ ] 3.4.1-r3 (3.4)
[M~ ] 3.4.3-r1 (3.4)
[ ~ ] 3.4.3.20050110-r1 (3.4)
[ I] 3.4.3.20050110-r2 (3.4)
[M~ ] 3.4.4 (3.4)
[M ] 4.0.0 (4.0)
[M ] 4.0.1_pre20050607 (4.0)
[M ] 4.1.0_beta20050604 (4.1)
|
OK , I start to get the overall picture.
So if the Boss's main concern is to remain "stable" suggest 3.4.3.20050110-r2 as the system compiler. Even 4.0 has come out of hiding now! That means 3.3.x is two generations old now . In gentoo terms we're talking dinosaur here.
I switched a year ago as I said and havent seen a prob yet (YMMV)
If you do decide to upgrade, cover your options by cloning the root parition first.
It's obviously a major change to make to anyone else's system , let alone the boss's but I get the feeling the boss probably does his own system admin, yeh?
If that's really cast in stone and he's not ready to quit faithful old 3.3 then I guess you have two choises.
1. Go static. If he's got a quad xeon I'm sure he's got more disk space than he can count.
2. I'm not arrogant enough to say there no other choice I just cant see it.
HTH8) _________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
 |
CMoH n00b


Joined: 08 Sep 2004 Posts: 27 Location: Timisoara, Romania
|
Posted: Tue Jun 14, 2005 8:13 pm Post subject: |
|
|
danmitchell wrote: | Yes, but if my project needs gcc 3.4 to compile and it needs libfoo that was built with gcc 3.3, what am I to do? How can one test software with gcc X, Y, and Z when all the system libraries are built with X? |
As far as I know GCC 3.3 is binary incompatible with GCC 3.4 (with regard to C++). Some brief discussions with more informed people revealed that the 3.3 name mangling was incomplete, so they redesigned it in 3.4 in an incompatible manner.
However, if rebuilding the system is (still - after reading the other posts) not an option, why not build libfoo with 3.4 and ship the binary library alongside the executable? |
|
Back to top |
|
 |
|