Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version `GLIBCXX_3.4.22' not found

I have built a C++ app on a VM Ubuntu 16.04 on which I have installed g++ compiler 6.2.0 in order to support C++14 features. When I tried to run it on new clean VM 16.04 which has default the g++ 5.4.0 the error /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found pops up.
I've noticed that on the VM with the updated compiler library libstdc++.so.6.0.22 has been installed. On the clean VM I'd like to avoid to update the compiler so I tried to install only the latest libstdc++6 package. However the library that was installed was libstdc++.so.6.0.21 and so the problem persisted. How can I install specifically the libstdc++.so.6.0.22 version?

like image 787
dk13 Avatar asked Mar 28 '17 13:03

dk13


2 Answers

You need to upgrade libstdc++6 to latest version like this

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6

After that you can check if you get GLIBCXX desired version like this:

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
like image 118
Krishan Kumar Mourya Avatar answered Nov 12 '22 14:11

Krishan Kumar Mourya


You could try to use pinning to make sure only the packages you want are updated to a newer version.

Alternatively, you could simply compile your program with g++ 5.4, because according to this page, this compiler already supports all c++14, the only difference is that g++-6 defaults to -std=c++14, whereas with g++-5 you have to set the language standard explicitly.

like image 26
Gert Wollny Avatar answered Nov 12 '22 14:11

Gert Wollny