Eugene
Eugene

Reputation: 366

gcc: error while loading shared libraries -> looks up wrong library version

I upgraded my system (to ubuntu 13.04) and somewhere in the process gcc broke :-( I'm getting this exception when trying to compile something:

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/bin/as:
error while loading shared libraries:
libopcodes-2.22-system.so: cannot open shared object file: No such file or directory

Actually libopcodes-2.22-system.so does not exist, BUT libopcodes-2.23.2-system.so does. If i symlink from 2.22 to 2.23 gcc fails with just another library.

So for some reason it is looking for the wrong version. I wildly tried to solve it by reinstalling gcc, binutils, libc6 etc., but the problem still exists.

How can i tell gcc to use the correct shared library version? / Where does gcc gets the information which shared libraries to use?

Thx

Upvotes: 5

Views: 6680

Answers (1)

Eugene
Eugene

Reputation: 366

Thanks guys, your comments made me look at the right place.

This path made me suspicious:

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/bin/as

I thought it must be a symlink to /usr/bin/as, but it exposed that /usr/x86_64-linux-gnu/bin was a complete copy of /usr/bin - not up to date and therefore with incorrectly linked binaries. I have no idea why a copy of the whole bin directory was there and was used by gcc in favor of /usr/bin.

The compiler is running fine after /usr/x86_64-linux-gnu was removed. Edit: Better check comments before doing the same.

Upvotes: 3

Related Questions