Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

After upgrading Server 10.04 to 12.04, I was receiving errors related to lgcc_s while trying to compile with g++ and gcc. There are several versions of libgcc_s installed in /usr/lib/gcc/x86_64-linux-gnu/, including 4.6 and 4.8. If I create a symlink to the libgcc_s.so in the 4.6 directory to /usr/lib so its on my path, the compilation gives the error ld: unable to find lgcc_s. If I link the version from the 4.8 folder, everything works. Checking the version of libstdc++6 gives

apt-cache policy libstdc++6
libstdc++6:
  Installed: 4.8.1-2ubuntu1~10.04.1
  Candidate: 4.8.1-2ubuntu1~10.04.1
  Version table:
 *** 4.8.1-2ubuntu1~10.04.1 0
        100 /var/lib/dpkg/status
     4.6.3-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

The version of g++ is 4.6.3.

On a clean 12.04 install, only the 4.6 directory is available in /usr/lib/gcc/x86_64-linux-gnu/. Further, the output of apt-cache policy libstdc++6 is

libstdc++6:
  Installed: 4.6.3-1ubuntu5
  Candidate: 4.6.3-1ubuntu5
  Version table:
 *** 4.6.3-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

Why are the versions of libstdc++6 different after the install? Why does linking the library from the 4.8 directory work but the 4.6 directory doesn't? How can I remove the 4.8 version of libstdc++6 without wrecking its dependencies (which are pretty much every program on the system)?

Finally, the overarching reason for asking these questions is that I'm trying (and failing) to build several software packages (Cantera and RDKit) that are failing at various C++ compiler steps. I want to eliminate the gcc as the source of the problem, and this inconsistency sticks out to me.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

As you see in the clean installation the 4.8.1-2ubuntu1~10.04.1 version of the package doesn't exist in precise (I'm wondering from where you got it, since only saucy has that package, maybe a PPA). The best method is removing the package and installing from the repositories. In some cases apt-get will refuse so you must force it to do your will:

sudo apt-get -f install libstdc++6=4.6.3-1ubuntu5

I would check for other packages that might have the same condition.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.