/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
Asked Answered
L

19

143

How can I get GLIBCXX_3.4.15 in Ubuntu? I can't run some programs that I'm compiling.

When I do:

strings /usr/lib/libstdc++.so.6 | grep GLIBC

I get:

GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.4
GLIBC_2.3.4
GLIBC_2.3.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

Thanks for any help!

Ladyfinger answered 7/3, 2011 at 6:4 Comment(0)
L
81

I'm compiling gcc 4.6 from source, and apparently

sudo make install 

didn't catch this one. I dug around and found

gcc/trunk/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.15

I copied it in to /usr/lib and redirected libstdc++.so.6 to point to the new one, and now everything works.

Ladyfinger answered 7/3, 2011 at 6:20 Comment(8)
This works with gcc 4.6.2 as well except it's libstdc++.so.6.0.16. Thanks!Fabi
Mine is gcc 4.7 and libstdc++.so.6.0.17. Had the same problem, fixed with this solution. Kudos.Jehovah
Is there a way around this without having to manually compile gcc? Like a simple apt-get command, perhaps?Trifling
Yes, there is. An apt-get based solution to this problem is described here: superuser.com/questions/310809/…Trifling
This lame error has been tormenting CENTOS/Ubuntu/Linux users for a while now. And why exactly the developers of these OSs did not bother with a fix or an update?? Thanks for the fix btw :)!Winegar
@roosevelt: it's not a problem with the OS, it's a problem with users installing software themselves then not using the linker correctly. It's a FAQ: gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_pathsLomalomas
Thanks @Chris. your solution works for me. It takes couple of minutes to generate libstdc++.so.6.0.15Gallnut
In my case, I copied /usr/lib/x86_64-linux-gnu/libstdc++.so.6 into /usr/lib and then I soft linked /usr/lib/libstdc++.so.6.0.15 (replace by the one your program needs) to that.Squarely
U
63

I have been avoiding this issue in the past by simply linking libstdc++ statically with this parameter sent to g++ when linking my executable:

-static-libstdc++

If linking in the library statically is an option this is probably the quickest work-around.

Unreality answered 25/8, 2014 at 9:34 Comment(2)
The problem is that the library cannot be found, not that you should statically link. See the answer from @Hobo.Ineducable
This is helpful when you are out of the default make system and just want to have a POC on small code. There is no harm in statically linking a small code where size of binary...blah blah.... doesn't matter. Quick and easy fixWhatley
T
50

I was trying to get clang to work (which also requires 6.0.15), and while poking around I found it was installed at /usr/local/lib/libstdc++.so.6.0.15. It installed there when I installed graphite (an experimental gcc version).

If you need access to libraries at that location, then you’ll need to define LD_LIBRARY_PATH as:

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

I was able to get clang to work after doing this. Hope that is helpful to someone.

Titi answered 11/5, 2011 at 11:54 Comment(1)
I was working on an embedded target and i get the same problem, your solution seems not to work in my case. In fact most of the binary in the target uses the default c library in /lib, so changing LD_LIBRARY_PATH will affect them. they will all link to the new library, In the end most of the binaries are not working: such as ls grep,....: I'am getting : ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directoryDeem
A
15

I encounter this problem when trying to use matlab eng to call m functions from c code. which occurs with command mex -f .. ..

My solution:

strings /usr/lib/i386-<tab>/libstdc++.so.6 | grep GLIBC

I found it includes 3.4.15

so my system has the newest libs.

the problem comes from matlab itself, it calls its own libstdc++.so.6 from {MATLAB}/bin

so, just replace it with the updated system lib.

Arroba answered 8/5, 2013 at 16:37 Comment(3)
This seems to also work for me in Matlab 2013b x64 on Xubuntu 13.04 x64Lacombe
Thanks a lot. I just had to create a new symbolic link for the file in {MATLAB}/bin to the file in /usr/lib/, and then to restart matlab. This works in Matlab 2010b on Fedora 14 x64.Alkalinity
This worked for me when dealing with Lattice Radiant and prjoxide / nextpnr.Bernt
I
3

Sometimes you don't control the target machine (e.g. your library needs to run on a locked-down enterprise system). In such a case you will need to recompile your code using the version of GCC that corresponds to their GLIBCXX version. In that case, you can do the following:

  1. Look up the latest version of GLIBCXX supported by the target machine: strings /usr/lib/libstdc++.so.6 | grep GLIBC ... Say the version is 3.4.19.
  2. Use https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html to find the corresponding GCC version. In our case, this is [4.8.3, 4.9.0).
Inmesh answered 9/3, 2017 at 20:58 Comment(0)
E
2

I have just faced with similar issue building LLVM 3.7 version. first check whether you have installed the required library on your system:

$locate libstdc++.so.6.*

Then add the found location to your $LD_LIBRARY_PATH environment variable.

Endeavor answered 24/12, 2015 at 20:4 Comment(1)
This only works, if you have a libstdc++.so.6.* lib with GLIBCXX_3.4.15 supportWeltpolitik
P
1

I got same error. This is how it worked for me:

  • cleaned the project under currently installed gcc
  • recompiled it

Worked perfectly!

Pneumonia answered 26/6, 2012 at 13:21 Comment(0)
B
1

For this error, I copied the latest libstdc++.so.6.0.17 from other server, and removed the soft link and recreated it.

1. Copy the the libstdc++.so.6.0.15 or latest from other server to the affected system.
In my case SUSE linux 11 SP3 had latest.
2. rm libstdc++.so.6
3. ln -s libstdc++.so.6.0.17 libstdc++.so.6 (under /usr/lib64 directory).

nJoy

Belize answered 6/8, 2014 at 7:20 Comment(0)
A
0

Bug with GLIBCXX_3.4.14 You need to install a newer version of GCC. http://pkgs.org/download/libstdc++.so.6 goto:

http://geeksterminal.com/how-to-install-glib-glibc/1392/

and follow instructions.

Atomics answered 16/8, 2014 at 15:26 Comment(0)
S
0

I had the same problem because I changed the user from myself to someone else:

su

For some reason, after did the normal compiling I was not able to execute it (the same error message). Directly ssh to the other user account works.

Spermatozoon answered 1/4, 2015 at 11:49 Comment(6)
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question.Heilbronn
No it does because I had the exact same problem. It was caused by changing user. It could also have happened to someone else, say changing to root.Spermatozoon
My mistake! I was thrown by the first line, which looked like you also had the problem. Carry on!Heilbronn
I also used Ubuntu and also tried to compile programs and also got the same error message as in the question. My error was that I was doing it in another user account by using the su command. I think this answers the question because it addresses why and how about the problem. It's certainly a possibility.Spermatozoon
And one user had LD_LIBRARY_PATH set to find the newer lib but not the other user? That seems a bit far fetched in the specific context of this question.Sansculotte
I really didn't expect my little attempt to the question would have caused such a big fuss.I can't explain why it was like that, but it was indeed the case. I still believe my answer is valid because it attempts to give a possible solution which might happen if someone attempted to su to root and do some compiling.Spermatozoon
W
0

I had multiple versions of the gcc compiler installed and needed to use a more recent version than the default installation. Since I am not a system administrator for our Linux systems, I cannot just change /usr/lib or many of the other suggestions above. I was encountering this problem and eventually tracked it down to setting my path to the 32-bit library directory instead of the 64-bit library (lib64) directory. Since the libraries in the 32-bit directory were incompatible, the system defaulted to the older version which was out of date.

Using -L to the path I was referencing gave warnings about "skipping incompatible libstdc++.so when searching for -lstdc++". This was the hint that helped me finally resolve the problem.

Waterlog answered 22/6, 2015 at 22:22 Comment(0)
C
0

gcc version 4.8.1, the error seems like:

/root/bllvm/build/Release+Asserts/bin/llvm-tblgen: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /root/bllvm/build/Release+Asserts/bin/llvm-tblgen)

I found the libstdc++.so.6.0.18 at the place where I complied gcc 4.8.1

Then I do like this

cp ~/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.18 /usr/lib64/

rm /usr/lib64/libstdc++.so.6

ln -s libstdc++.so.6.0.18 libstdc++.so.6

problem solved.

Canady answered 22/7, 2015 at 15:17 Comment(0)
I
0

I've extracted them from an RPM (RPM for libstdc++) and then:

export LD_LIBRARY_PATH=.

To set the system to search for the libraries on the current directory. Then just executed my program. But in my case I've received a single executable that I needed, it wasn't a system wide change.

Iciness answered 13/10, 2016 at 10:25 Comment(0)
U
0

In my case LD_LIBRARY_PATH had /usr/lib64 first before /usr/local/lib64. (I was builing llvm 3.9).
The new gcc compiler that I installed to compile llvm 3.9 had libraries using newer GLIBCXX libraries under /usr/local/lib64 So I fixed LD_LIBRARY_PATH for the linker to see /usr/local/lib64 first.
That solved this problem.

Undershot answered 8/5, 2018 at 9:0 Comment(0)
D
0

I just used -static-libstdc++ while building. w/ that, I can run the a.out

g++ test.cpp -static-libstdc++
Dimphia answered 28/11, 2018 at 19:31 Comment(0)
C
-1

I've had a similar issue, and I've resolved it by statically linking libstdc++ into the program I was compiling, like so:

$ LIBS=-lstdc++ ./configure ... etc.

instead of the usual

$ ./configure ... etc.

There might be problems with this solution to do with loading shared libraries at runtime, but I haven't looked into the issue deeply enough to comment.

Currajong answered 11/6, 2013 at 18:2 Comment(0)
H
-1

Same thing with gcc version 4.8.1 (GCC) and libstdc++.so.6.0.18. Had to copy it here /usr/lib/x86_64-linux-gnu on my ubuntu box.

Horologe answered 26/6, 2013 at 7:22 Comment(0)
I
-1

I had the same problem before, and fixed that, the steps could be found on this Fixing error "GLIBCXX_3.4.15" on matlab

Isodiametric answered 9/10, 2013 at 16:59 Comment(0)
H
-1

For testing purposes:

On the original machine, find the library, copy to the same directory as the executable:

$ ldconfig -p | grep libstdc
        libstdc++.so.6 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
        libstdc++.so.6 (libc6) => /usr/lib32/libstdc++.so.6
$ cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 .

Then copy this same library to the target machine, and run the executable:

LD_LIBRARY_PATH=. ./myexecutable

Note: command above is temporary; it is not a system-wide change.

Hebetate answered 1/4, 2020 at 12:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.