My project is built on Ubuntu 14.04 in C++ using g++.

Previously, my project used g++ 4.8 for development. Our software depends on the libstdc++6 to run.

We provide Debian packages to install our software. Our Debian package only installs the run-time libraries that are needed to run our software. We don't want to install development tools for our customer. But because the libstdc++6 is already installed along with Ubuntu 14.04 by default, we therefore didn't specify it in Debian package's 'control' file.

Recently, we switched to g++ 4.9. To install g++ 4.9, we need to add its PPA before we run 'apt-get install' to install our software. Having realized that I also need to use the libstdc++6 that works with g++ 4.9, I put 'libstdc++6' in the 'Depends' section of the 'control' file. Something like this:

Depends: libstdc++6 (Other packages are omitted)

When doing the 'sudo apt-get install our-package', I realized that the libstdc++6 is NOT upgraded to the one I want. Therefore, I would get the run-time error messages like:

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

I did make sure that:

  • I had added the g++ 4.9 PPA to the system (ppa:ubuntu-toolchain-r/test);
  • I had run 'apt-get update' after adding it.

In contrast, if I ran sudo apt-get install libstdc++6 manually, the libstdc++6 would be upgraded to the correct one.

My theory is that the 'Depends' section of the 'control' file works more like checking the existence but not version, and because Ubuntu 14.04 had installed libstdc++6, the Debian package didn't install/upgrade it because it could be found in the system already. However, 'apt-get install' checked the most recent version and installed it if missing or upgraded it if existing.

Any ideas??

  • Hard to tell from what you posted but my guess is either you did not specify a version in your depends or more likely the version in your ppa is the same or lower then the version in the repos. "Depends: libstdc++6 (>= x.x.x)" or similar syntax perhaps ? – Panther Jul 13 '17 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.