# Upgrading gcc problems.

## chrisaw

OK, people have been having problems with upgrading to gcc 3.4.4 (me included) and i managed to fix it. So, i thaught i'd write a guide on how i did it just incase its of any use to anyone =) This guide is also suitable for future versions =)

My problem was the following:

```
/usr/bin/python: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
```

OK, so here we go...

1.) Firstly, we need to figure out what version your running of gcc right now and what you want to upgrade to. If you already know for certain you may skip to step 2.

```
find /usr/lib/ -name libstdc*a
```

Allthough your version may differ from the one above we you should still be able to fix it with the same methods =) This command may fail and if so don't worry about it, we can still get the version.

You should get an output like the following:

```
dragon / # find /usr/lib/ -name libstdc*a

/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libstdc++.la

/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libstdc++.a

/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libstdc++_pic.a
```

From this we can guess that the safe version of gcc is 3.4.4.

2.) Edit your /etc/ld.so.conf with your desired editor (Personally i used nano but the choice is yours.) and change the line containing /usr/lib/gcc/ to the version we found above (3.4.4 in this case). Such as the example below:

```
# ld.so.conf autogenerated by env-update; make all changes to

# contents of /etc/env.d directory

/usr/local/lib

/usr/i686-pc-linux-gnu/lib

/usr/lib/gcc/i686-pc-linux-gnu/3.4.4

/usr/lib/libstdc++-v3/
```

3.) Now run the following command to apply your settings.

```
ldconfig -v
```

4.) OK, so now were on the version before the latest, great! Now lets get on to the latest =) You should be able to run gcc-concig now run gcc-config -l and you should get an output similar to the following.

```
dragon / # gcc-config -l

[1] i386-pc-linux-gnu-3.3.5

[2] i386-pc-linux-gnu-3.3.5-hardened

[3] i386-pc-linux-gnu-3.3.5-hardenednopie

[4] i386-pc-linux-gnu-3.3.5-hardenednossp

[5] i686-pc-linux-gnu-3.4.4

[6] i686-pc-linux-gnu-3.4.4-hardened

[7] i686-pc-linux-gnu-3.4.4-hardenednopie

[8] i686-pc-linux-gnu-3.4.4-hardenednopiessp

[9] i686-pc-linux-gnu-3.4.4-hardenednossp
```

5.) If you do get this then now run:

```
gcc-config 5 (Or whichever is the latest && source /etc/profile && fix_libtool_files.sh 3.4.4 (or whatever the safe version was)
```

6.) You "should" now be on the latest gcc version, congrats! Let's test it with the following:

```
env-update
```

7.) If you didn't get any errors from the env-update command then youre fully operational =)

Thanks fly out to kloeri for his help with this problem!

EDIT: Sorry folks, i messed the version numbers up =$ Fixed now! =)Last edited by chrisaw on Thu Jun 30, 2005 9:57 pm; edited 10 times in total

----------

## UncleOwen

gcc-3.4.5? wtf are you talking about? There is no gcc-3.4.4, neither in portage nor on gcc.gnu.org.

----------

## xafan

 *UncleOwen wrote:*   

> gcc-3.4.5? wtf are you talking about? There is no gcc-3.4.4, neither in portage nor on gcc.gnu.org.

 

Huh? http://gcc.gnu.org/gcc-3.4/

----------

## UncleOwen

 *Quote:*   

> May 18, 2005
> 
> The GNU project and the GCC developers are pleased to announce the release of GCC 3.4.4.
> 
> This release is a bug-fix release, containing fixes for regressions in GCC 3.4.3 relative to previous releases of GCC.

 

No 3.4.5

----------

## astralbat

Thats great!

I thought I really trashed my system..!

Now if only I knew what all that meant!  :Smile: 

----------

## Maedhros

Moved from Other Things Gentoo to Documentation, Tips & Tricks.

For anyone still having problems, please follow up here: https://forums.gentoo.org/viewtopic-t-344483.html

----------

## Karsten1973

This has been very helpful!!! Thank you!

----------

## buckminster

Hi,

it works very well. Thanks a lot.

edit: it works as long as it comes to emerge an kde 3.4.1 package

All people who do say, that one of the greatest advantages of gentoo is this forum, are right.

Thanks

Frank

----------

## Koala Kid

Thank you very much, worked great for me.  :Razz: 

----------

## Koala Kid

Not so good... emerge gnome-vfs-2.10.0-r2 fails with the following error:

```
 i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -I../imported/neon -pthread -DORBIT2=1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -pthread -DORBIT2=1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -D_FILE_OFFSET_BITS=64 -D_BSD_SOURCE -D_LARGEFILE64_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DSSH_PROGRAM=\"/usr/bin/ssh\" -DG_DISABLE_DEPRECATED -DDATADIR=\"/usr/share\" -DPREFIX=\"/usr\" -DLIBDIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DG_LOG_DOMAIN=\"gnome-vfs-modules\" -march=athlon-xp -O2 -pipe -fomit-frame-pointer -c fstype.c -MT fstype.lo -MD -MP -MF .deps/fstype.TPlo -o fstype.o >/dev/null 2>&1

/bin/sh ../libtool --mode=link i686-pc-linux-gnu-gcc  -march=athlon-xp -O2 -pipe -fomit-frame-pointer   -o libfile.la -rpath /usr/lib/gnome-vfs-2.0/modules -export_dynamic -avoid-version -module -no-undefined file-method.lo fstype.lo -lfam -Wl,--export-dynamic -pthread -lgobject-2.0 -lgconf-2 -lORBit-2 -lm -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0   ../libgnomevfs/libgnomevfs-2.la -lrt

grep: /usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110/libstdc++.la: No such file or directory

/bin/sed: can't read /usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110/libstdc++.la: No such file or directory

libtool: link: `/usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110/libstdc++.la' is not a valid libtool archive

make[2]: *** [libfile.la] Error 1

make[2]: Leaving directory `/var/tmp/portage/gnome-vfs-2.10.0-r2/work/gnome-vfs-2.10.0/modules'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/var/tmp/portage/gnome-vfs-2.10.0-r2/work/gnome-vfs-2.10.0'

make: *** [all] Error 2

!!! ERROR: gnome-base/gnome-vfs-2.10.0-r2 failed.

!!! Function gnome2_src_compile, Line 41, Exitcode 2

!!! compile failure

!!! If you need support, post the topmost build error, NOT this status message.

```

My /etc/ld.so.conf

```
# ld.so.conf autogenerated by env-update; make all changes to

# contents of /etc/env.d directory

/usr/local/lib

/usr/lib/opengl/nvidia/lib

/usr/i686-pc-linux-gnu/lib

/usr/lib/gcc/i686-pc-linux-gnu/3.4.4

/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4

/usr/lib/MozillaFirefox

/usr/lib/mozilla

/usr/lib

/usr/lib/openmotif-2.2

/opt/blackdown-jdk-1.4.2.01/jre/lib/i386/

/opt/blackdown-jdk-1.4.2.01/jre/lib/i386/native_threads/

/opt/blackdown-jdk-1.4.2.01/jre/lib/i386/classic/

/opt/blackdown-jdk-1.4.2.01/jre/lib/i386/server/

/usr/qt/3/lib

/usr/kde/3.4/lib

/usr/kde/3.3/lib

/usr/lib/nspr

/usr/lib/nss

/usr/games/lib

/usr/lib/libstdc++-v3/

```

gcc-config -l:

[1] i686-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

What's going on here ?

Thank you.

----------

## Maedhros

That looks like this perennial problem: https://forums.gentoo.org/viewtopic-t-279020.html  :Wink: 

----------

## Koala Kid

Well, it doesn't work. I ran

```
fix_libtool_files.sh 3.3.4
```

 and then 

```
env-update && source /etc/profile
```

but it still fails with the same message.

----------

## Ibn al-Hazardous

Thanks! This was just what I needed.

I have just one comment, though. In step 1)

 *Quote:*   

> gcc-config -c

 

and

 *Quote:*   

> find /usr/lib/ -name libstdc*a

 

produced different results. The result that find gave was the correct, while the result from gcc-config -c wsa b0rked. Perhaps you should only list the find-method?

Thanks again!  :Smile: 

----------

## Bob P

Great Post @chrisaw!  anyone who upgrades from GCC 3.4.3 to GCC 3.4.4 is going to need to read this thread.  I just updated a perfectly functional GCC 3.4.3 system to GCC 3.4.4 and ran into the folloing problem immediately after emerging gcc:

```
# gcc-config -l

/usr/bin/gcc-config: line 1: /etc/env.d/gcc/i686-pc-linux-gnu-3.4.3-20050110: No such file or directory

 * /usr/bin/gcc-config: Profile does not exist or invalid setting for /etc/env.d/gcc/i686-pc-linux-gnu-3.4.3-20050110

[1] i686-pc-linux-gnu-3.4.4

[2] i686-pc-linux-gnu-3.4.4-hardened

[3] i686-pc-linux-gnu-3.4.4-hardenednopie

[4] i686-pc-linux-gnu-3.4.4-hardenednopiessp

[5] i686-pc-linux-gnu-3.4.4-hardenednossp

```

so i tried specifying the first option, and here's what happened:

```
gentoo pentium # gcc-config 1

 * Switching to i686-pc-linux-gnu-3.4.4 compiler...

/usr/bin/python: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

 * /usr/bin/gcc-config: Could not get portage CHOST!

/usr/bin/gcc-config: line 1: env: command not found

 * /usr/bin/gcc-config: Could not get portage CHOST!

/usr/bin/python: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

 * /usr/bin/gcc-config: Could not get portage CHOST!

/usr/bin/python: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

 * /usr/bin/gcc-config: Could not get portage CHOST!

/usr/bin/python: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

 * /usr/bin/gcc-config: Could not get portage CHOST!                                                                                                  [ ok ]

 * If you intend to use the gcc from the new profile in an already

 * running shell, please remember to do:

 *   # source /etc/profile

```

interestingly, the libstdc++.so.6 file is indeed available as a symlink to libstdc++.so.6.0.3:

```
gentoo pentium # ls -lh /usr/lib/gcc/i686-pc-linux-gnu/3.4.4

total 5.3M

-rw-r--r--  1 root root 1.7K Jun  4 14:03 crtbegin.o

-rw-r--r--  1 root root 2.2K Jun  4 14:03 crtbeginS.o

-rw-r--r--  1 root root 2.0K Jun  4 14:03 crtbeginT.o

-rw-r--r--  1 root root 1.3K Jun  4 14:03 crtend.o

-rw-r--r--  1 root root 1.5K Jun  4 14:03 crtendS.o

-rw-r--r--  1 root root 4.5K Jun  4 14:03 hardened.specs

-rw-r--r--  1 root root 4.5K Jun  4 14:03 hardenednopie.specs

-rw-r--r--  1 root root 4.5K Jun  4 14:03 hardenednopiessp.specs

-rw-r--r--  1 root root 4.5K Jun  4 14:03 hardenednossp.specs

drwxr-xr-x  4 root root  536 Jun  4 14:03 include

drwxr-xr-x  3 root root  136 Jun  4 14:03 install-tools

-rw-r--r--  1 root root 1.2K Jun  4 14:03 libfrtbegin.a

-rw-r--r--  1 root root 349K Jun  4 14:03 libg2c.a

-rwxr-xr-x  1 root root  754 Jun  4 14:03 libg2c.la

lrwxrwxrwx  1 root root   15 Jun  4 14:03 libg2c.so -> libg2c.so.0.0.0

lrwxrwxrwx  1 root root   15 Jun  4 14:03 libg2c.so.0 -> libg2c.so.0.0.0

-rwxr-xr-x  1 root root 160K Jun  4 14:03 libg2c.so.0.0.0

-rw-r--r--  1 root root 259K Jun  4 14:03 libgcc.a

-rw-r--r--  1 root root  94K Jun  4 14:03 libgcc_eh.a

lrwxrwxrwx  1 root root   13 Jun  4 14:03 libgcc_s.so -> libgcc_s.so.1

-rw-r--r--  1 root root  35K Jun  4 14:03 libgcc_s.so.1

-rw-r--r--  1 root root  37K Jun  4 14:03 libgcov.a

-rw-r--r--  1 root root 1.7M Jun  4 14:03 libstdc++.a

-rwxr-xr-x  1 root root  909 Jun  4 14:03 libstdc++.la

lrwxrwxrwx  1 root root   18 Jun  4 14:03 libstdc++.so -> libstdc++.so.6.0.3

lrwxrwxrwx  1 root root   18 Jun  4 14:03 libstdc++.so.6 -> libstdc++.so.6.0.3

-rwxr-xr-x  1 root root 812K Jun  4 14:03 libstdc++.so.6.0.3

-rw-r--r--  1 root root 1.8M Jun  4 14:03 libstdc++_pic.a

-rw-r--r--  1 root root 149K Jun  4 14:03 libsupc++.a

-rwxr-xr-x  1 root root  849 Jun  4 14:03 libsupc++.la

-rw-r--r--  1 root root 4.5K Jun  4 14:03 specs

-rw-r--r--  1 root root 4.5K Jun  4 14:03 vanilla.specs

```

the aforementioned solution of editing the contents of /etc/ld.so.conf to reflect the correct version of GCC, followed by ldconfig -v solved the problem.   :Wink: 

----------

## Bob P

just wondering -- has this problem already been reported to bugzilla?

----------

## Ibn al-Hazardous

 *Koala Kid wrote:*   

> Well, it doesn't work. I ran
> 
> ```
> fix_libtool_files.sh 3.3.4
> ```
> ...

 

Presuming that you upgraded from 3.4.3 to 3.4.4, while keeping 3.3.4 in the other slot, you might try:

```
fix_libtool_files.sh 3.3.4
```

----------

## Ibn al-Hazardous

 *Ibn al-Hazardous wrote:*   

>  *Koala Kid wrote:*   Well, it doesn't work. I ran
> 
> ```
> fix_libtool_files.sh 3.3.4
> ```
> ...

 

Doh!

```
fix_libtool_files.sh 3.4.3
```

Teh typo king!

----------

## zeveck

 :Very Happy:  THANK YOU!!  :Very Happy: 

I was convinced my system was hosed and you saved it. W00t!

Also, I concur with Ibn al-Hazardous. The output of gcc-config -c was just wrong. Had I used that number instead of find I doubt things would have worked because no such file existed.

----------

## Bob P

 *zeveck wrote:*   

>  THANK YOU!! 
> 
> I was convinced my system was hosed and you saved it. W00t!
> 
> Also, I concur with Ibn al-Hazardous. The output of gcc-config -c was just wrong. Had I used that number instead of find I doubt things would have worked because no such file existed.

 

if the output of gcc-config -c is wrong, then you need to file a bug report!

----------

## Bob P

my problem reported to bugzilla:  https://bugs.gentoo.org/show_bug.cgi?id=95062

i'd still recommend filing the bug report about the gcc-config -c error.

----------

## chrisaw

Thanks for all your feedback folks! =) Glad to help the great people that make up this excellent community =D

----------

## annunaki2k2

Just another grateful gentoo user here wishing to add my thanks.....

This solution worked a treat for me  :Very Happy: 

Koala Kid:

As a tip, try running 

```
fix_libtool_files.sh 3.4.3-20050110
```

just incase if you haven't managed to resolve this one yet

I've had my system running now as ~x86 since installing with 1.4r2 and would be devistated if I had to reinstall!

Thanks once again!

----------

## Koala Kid

 *annunaki2k2 wrote:*   

> 
> 
> Koala Kid:
> 
> As a tip, try running 
> ...

 

Thank you, that's exactly what solved the problem  :Razz: 

Actually, thank you all, guys.

----------

## Gentoonie

I had the same problem, my system was kinda fucked up.

However, i found out that if you emerge the 3.4.4 with the USE-variable "multislot", you dont run into that problems!

----------

## Nemein

What Gentoonie said could be very true, as previous versions of GCC didn't prune older versions as they were emerged. With GCC 3.4.4, it so happens that it prunes any previously used version of GCC before all of the libraries are switched. Good call Gentoonie. Oh, and thx chrisaw, you saved my install of Gentoo  :Wink:  Thanks a lot for sharing the info on the fix m8.

----------

## opensas

Worked OK around here

Just had to 

```
fix_libtool_files.sh 3.4.3-20050110
```

Thanks a lot for the tip

Saludos

Sas

PS: Just a couple of questions

Is this a bug? When gcc 3.4.4 gets finnaly unmasked, will we have to do this trick?

Why can't portage just emerge the new gcc version, while finishing the whole thing with the previous one?

Or may be even better

Why can't portage detect you are emerging gcc and let you choose to do the whole compile with the old or the new gcc?

I think the best would be that portage would emerge gcc stuff prior to anything else, then set the recently emerged gcc version as the current (gcc-config) and finally finish emerging the rest of the stuff. Does anybody know if this is the portage normal behaviour?

Well, thanks again for this lifesaver, and I hope you don't mind all this questions  :Wink: 

----------

## rel

just wanna thank kloeri for his help on this

-aap

----------

## MikeTheGreat

Yet another gratefull newbie here. Thanks for the information. You saved my installation.

----------

## Sprotte

uh. ok.

I´m gonna try this, looks as if it will work.

But I´ve gotta say, stuff like this just shouldn´t happen. I´m doing emerge -Du system on my home router and last night I just figured out why Perl wouldn´t emerge (it wanted gdbm in the use flags).

This night I´m fixing gcc. Manually. What´s next? This update should be done by now.

I have really conservative cflags etc... It´s just getting frustrating, instead of typing "emerge -Du system" and then taking a nap or watching Star Trek, I´m surfing the net on one console while emerge runs in another... I don´t trust it anymore.

Just to explain why I´m so pissed... It´s not the first time. Granted, you find most problems solved on this forum. But that shouldn´t become the standard. The standard should be that I type "emerge -Du system" and it just works.

I´m contemplating switching to x86 from ~x86 on all my boxes.. perhaps then I won´t see those problems anymore... but somehow I doubt that. I will just see the problems later.

Another thing I´m contemplating is just grabbing those old Suse 8.0 CD´s, installing them and then just online-updating them. My Cflags are already down to -O2 -fomit-frame-pointer, so I guess Suse won´t run that much slower. I could just install the same stuff I have now and ignore the rest. 

The only thing keeping me from doing that is my network setup, and my (by now) fine-tuned configuration. Also, running a headless home router on Suse seems overkill...

but c´mon, I should be able to install friggin´ gcc !!!

/vent mode off

I´ve come to the conclusion that all software sucks, especially operating systems.

Gentoo just sucks less...

EDIT 1 : yes, it works.

EDIT 2 : will probably go to x86. Still, a package with this kind of problem shouldn´t even be in unstable.

EDIT 3: Aaaaaaaaaaargh. I´ve gotten an answer to "what´s next" ... glibc is next. Why, it´s only glibc... and I shouldn´t run ~x86 anyway... and this is Gentoo, so I shouldn´t whine and just fix it...*sigh*

At this point, I´m ready to download and burn a FreeBSD CD ... in fact, I am doing that. *sad* I have a free partition... hmmm.... 

As others said earlier, Gentoo is a PITA when it comes to maintenance.  

After a year of gentoo I´m also starting to doubt that all the compiling from source is really necessary. Suse, Knoppix etc are not that much slower... and even on Suse, I can install gcc (very easily, I might add) and compile critical packages like vlc or mplayer myself. Nothing keeps one from doing that... in fact, I am doing more and more compiling by hand even on Gentoo (vlc (performance), joequake (no ebuild), fuhquake (performance), nethack (developing), CVS stuff...).

I can live with the thought that some of my system will have been compiled for 386, or without -funroll-loops, or that my disk usage is 10% higher because of some unneeded dependencies and no USE flags. In return, I get more spare time and more sleep. Good deal if you ask me.

Somebody please say "Goodbye you loser" now. That would generate just the final bit of impulse necessary to do rm -rf /.

----------

## bitwise

Thank you, this saved my system. I knew the problem was of this sort, but this saved me a load of time.

It really is these forums that makes gentoo so great  :Smile: 

----------

## j-m

Some notes:

1/ This is a generic problem with previous GCC version path being hardcoded into some files linked with libstdc++ . So no - it has nothing to do with stable or unstable, occurs on both after upgrade.

2/ Generic way to fix the problem:

```

fix_libtool_files.sh <version_that_ebuild_complains_about>

```

More info on this can be found in bugzilla. A better way to handle this is being worked on in Bug 71265 

HTH.

----------

## cgmd

Hi, all...

A lot of forum discussion involves gcc issues, related to updating problems. I'm relatively new to linux and my gentoo 2.6 box shows the following gcc version: 

```
# gcc-config -l

[1] i686-pc-linux-gnu-3.3.5-20050130 *

[2] i686-pc-linux-gnu-3.3.5-20050130-hardened

[3] i686-pc-linux-gnu-3.3.5-20050130-hardenednopie

[4] i686-pc-linux-gnu-3.3.5-20050130-hardenednossp

```

Would someone please tell me if there is reason to upgrade to a later version? If so, to what version would be recommended?

Thanks...

----------

## j-m

 *cgmd wrote:*   

> 
> 
> Would someone please tell me if there is reason to upgrade to a later version? If so, to what version would be recommended?
> 
> Thanks...

 

Well, gcc-3.3.6 is now here - with quite a few bugfixes... Personally, I really like 3.4.4. It´s up to you.  :Smile: 

----------

## balkira

thanks alot man !!

It simply resolved my problem!

bless

----------

