Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GLIBCXX_3.4.21 not found on CentOS 7

I recently updated my gcc version on CentOS from 4.7 to 5.4, but now I am getting the following error when I compile my program

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

I found some solutions , but I am still not able to fix the issue. These are the paths I found with whereis gcc

gcc: /usr/bin/gcc /usr/lib/gcc /usr/local/bin/gcc /usr/local/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz

and used this libstdc package for CentOS.

like image 432
viz12 Avatar asked May 26 '17 15:05

viz12


3 Answers

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

like image 95
SBDK8219 Avatar answered Nov 07 '22 11:11

SBDK8219


Maybe for someone it will be helpful: I installed devtoolset-7 but there was no GLIBCXX_3.4.21, and maximum version was GLIBCXX_3.4.19. Long time I was looking for the solution. What worked for me: I cloned gcc 7.3 repo, made build and install. Then copied libstdc++.so.6 and libstdc++.so.6.0.24 to devtools-7, lib64 folder and it became work.

like image 6
Igor Avatar answered Nov 07 '22 11:11

Igor


I didn't have sudo access to my CentOS machine, so I installed gcc with conda. If you installed gcc with conda the above answer won't work. check your gcc installation path as:

$ which gcc

output: /home/ags/miniconda3/envs/GE/bin/gcc

This tells that gcc is installed in GE conda environment, now export LD_LIBRARY_PATH as the path to lib directory this environment.

export LD_LIBRARY_PATH=/home/ags/miniconda3/envs/GE/lib:$LD_LIBRARY_PATH

Hope this helps.

like image 3
Rishabh Agrahari Avatar answered Nov 07 '22 12:11

Rishabh Agrahari