I have created c++ application in Ubuntu machine. I have copied binary to Centos machine. Got error:

/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found

I have installed packages I thought was needed:

yum install gcc gcc-c++ make openssl-devel

Still got the same error.

Then I have installed whole development tools:

yum groupinstall 'Development Tools'

Still have the same error. How to solve this problem?


I decided to check which versions of glibc I have in my machines with help of ldd --version command:

Ubuntu: 2.23
Centos6.9: 2.12

Why CentOS cmplains regarding GLIBCXX_3.4.21, while Ubuntu owns glibc version 2.23?

2 Answers 2


this worked for me on CentOS7

export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64



Does not exist (on a Centos 7 system with also the EPEL repository enabled)

$ sudo yum whatprovides '*libstdc++*' | egrep -o '3\.4\.[0-9]+' | sort -u

so you'll need to find a repository that does provide it, or compile the appropriate version of the library yourself and possibly patchelf up your binary to use that appropriate version of the library. Or, allow for 3.4.19 as that's the highest number the above command presents for me (for Centos 7; Centos 6 or older will doubtless have lower numbers available).

  • What do you mean allow for 3.4.19? How to do that? I have updated my question body with new version number misunderstanding.
    – vico
    Feb 11, 2018 at 12:05
  • Different linux are different. You can either compile for each one, or try to compile something more portable, or try to use something like patchelf to fiddle around with the libraries. Or you can ship all the libraries your binary needs with the binary, or you can try to build RPM for the glibc that Ubutu has (without breaking what RedHat ships, hopefully) ...
    – thrig
    Feb 11, 2018 at 15:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .