How to fix the error “libstdc++.so.6: wrong ELF class: ELFCLASS64” after installed GCC 4.6

Posted: May 30, 2011 in Android, Ubuntu
Tags: , , ,

Hello folks. If you compiled and installed GCC 4.6 and during the Android Gingerbread (or another software) compilation you received the following error message: “libstdc++.so.6: wrong ELF class: ELFCLASS64”.

Don’t worry about that. You are just using a wrong architecture of the libstdc++.so.6 in the folder /usr/lib32 in Ubuntu 64 bits. To solve that, open a terminal, go to the place where you have built GCC 4.6 and run the commands below:

sudo cp build/x86_64-unknown-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6.0.16 /usr/lib32
cd /usr/lib32

sudo rm libstdc++.so.6
sudo ln -s libstdc++.so.6.0.16 libstdc++.so.6
sudo ln -s libstdc++.so.6.0.16 libstdc++.so
sudo ldconfig

Doing that, we copied the libstdc++.so.6 for 32 bits in /usr/lib32 and also updated the links to this one. Now, all software that need this lib for 32 bits will use this one for compilation.

Remember, the lib libstdc++.so.6.0.16 is the version when I compiled GCC 4.6. If you get the file recently, this version will be different. Just don’t forget to change the reference to this one.

That’s it. See you next time.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s