Linux 如何修复:/usr/lib/libstdc++.so.6:未找到版本“GLIBCXX_3.4.15”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19386651/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to fix: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
提问by user1667191
So I'm now desperate in finding a fix for this. I'm compiling a shared library .so in Ubuntu 32 bit (Have tried doing it under Debian and Ubuntu 64 bit, but none worked either)
所以我现在迫切希望找到解决办法。我正在 32 位 Ubuntu 中编译共享库 .so(曾尝试在 Debian 和 Ubuntu 64 位下执行此操作,但都没有奏效)
I keep getting: /usr/lib/libstdc++.so.6: version ``GLIBCXX_3.4.15' not found
every time I try to load my plugin.
我不断收到:/usr/lib/libstdc++.so.6: version ``GLIBCXX_3.4.15' not found
每次我尝试加载我的插件时。
Here's how I'm getting this error:
这是我收到此错误的方式:
- Install latest Ubuntu 32 bit
- sudo apt-get install build-essential
- Compile & load my plugin (.so)
- 安装最新的 Ubuntu 32 位
- sudo apt-get install build-essential
- 编译并加载我的插件 (.so)
Here are some links which I found and tried, but none worked for me:
以下是我找到并尝试过的一些链接,但没有一个对我有用:
(My old question: I somehow got it fixed a few days after posting this question, but I can't remember how exactly I did it)
(我的老问题:我在发布这个问题几天后以某种方式修复了它,但我不记得我是怎么做的)
Another user with the same problem
I see some people fixed it by moving libstdc++(i think) to some directory and then pointing or linking idk what to that directory, but that just puzzled me.
我看到有些人通过将 libstdc++(我认为)移动到某个目录然后将 idk 指向或链接到该目录来修复它,但这让我感到困惑。
Anyone know a fix?
有人知道修复吗?
(Edit:)
- Running: strings /usr/lib/libstdc++.so.6 | grep GLIBC
in terminal gives me: strings '/usr/lib/libstdc++.so.6': No such file
. Could that be the problem? And if so, how do I install this library?
(编辑:) - 运行:strings /usr/lib/libstdc++.so.6 | grep GLIBC
在终端给我:strings '/usr/lib/libstdc++.so.6': No such file
. 这可能是问题吗?如果是这样,我该如何安装这个库?
(Edit2:) Anyone else know of a solution?
(Edit2 :) 还有其他人知道解决方案吗?
(Edit3) Still in need of a solution. is there a way to see on which distro a shared library was compiled on? I know I once compiled this same library a while ago, but can't remember!!
(Edit3) 仍然需要一个解决方案。有没有办法查看共享库是在哪个发行版上编译的?我知道我不久前曾经编译过同一个库,但不记得了!!
(Edit4) ldd my_lib_.so
gives me:
(Edit4)ldd my_lib_.so
给我:
linux-gate.so.1 => (0xb77d7000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb76c1000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb76a4000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb74fa000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb74ce000)
/lib/ld-linux.so.2 (0xb77d8000)
ldd program_im_loading_so_into
gives me:
ldd program_im_loading_so_into
给我:
linux-gate.so.1 => (0xb77d8000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb77c0000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb77a5000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb76bb000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb768f000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7672000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb74c9000)
/lib/ld-linux.so.2 (0xb77d9000)
running strings /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep GLIBCXX
gives me:
跑步strings /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep GLIBCXX
给了我:
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
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH
and finally here's my gcc version:
最后这是我的 gcc 版本:
`gcc version 4.6.4 (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04)`
回答by yggdrasil
Up above, you mention having compiling your as part of your steps to reproduce, but then below you made an edit saying,
在上面,您提到将编译作为您重现步骤的一部分,但是在下面您进行了编辑,说,
"is there a way to see on which distro a shared library was compiled on?"
“有没有办法查看共享库是在哪个发行版上编译的?”
Whether or not you compiled this on the same distro, and even a different version of the same distro is an important detail, especially for c++ applications.
你是否在同一个发行版上编译它,甚至同一个发行版的不同版本都是一个重要的细节,尤其是对于 c++ 应用程序。
Linking to c++ libraries, including libstdc++ can have mixed results, as far as I can tell. Here is a related question about recompiling with different versions of c++.
据我所知,链接到 C++ 库(包括 libstdc++)可能会产生不同的结果。这是一个有关使用不同版本的 c++ 重新编译的相关问题。
do we need to recompile libraries with c++11?
Basically, if you compiled against c++ on a different distro (and possibly different gcc version), this may be causing your trouble.
基本上,如果您在不同的发行版(可能还有不同的 gcc 版本)上针对 c++ 进行编译,这可能会给您带来麻烦。
I think you have two options:
我认为你有两个选择:
- Your best bet - recompile your .so if you hadn't compiled it on your current system. If there is a problem with your runtime's system environment, it might even come out in the compile.
- Bundle your other compiler's c++ libs along with your application. This may only be viable if it's the same distribution... But it's a useful trick if you rolled your own compiler. You will also have to set and export the LD_LIBRARY_PATH to the path containing your bundled stdc++ libs if you go that route.
- 您最好的选择 - 如果您没有在当前系统上编译它,请重新编译您的 .so。如果你的运行时系统环境有问题,它甚至可能在编译中出现。
- 将您的其他编译器的 c++ 库与您的应用程序捆绑在一起。这可能只有在它是相同的发行版时才可行......但如果你使用自己的编译器,这是一个有用的技巧。如果你走那条路,你还必须设置 LD_LIBRARY_PATH 并将其导出到包含捆绑的 stdc++ 库的路径。
回答by kerim
Link statically to libstdc++ with -static-libstdc++
gcc option.
使用-static-libstdc++
gcc 选项静态链接到 libstdc++ 。
回答by luart
Just install the latest version from nondefault repository:
只需从非默认存储库安装最新版本:
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install libstdc++6-4.7-dev
回答by Shubhamoy
I fixed this issue by installing: sudo apt-get install libstdc++6
我通过安装解决了这个问题: sudo apt-get install libstdc++6
In my case, I ran into this issue after installing MongoDB 3.0.1
就我而言,我在安装 MongoDB 3.0.1 后遇到了这个问题
mongo: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by mongo)
mongo:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:未找到版本“GLIBCXX_3.4.18”(mongo 需要)
回答by Rob
If someone has the same issue as I had - make sure that you don't install from the Ubuntu 14.04 repo onto a 12.04 machine - it gives this same error. Reinstalling from the proper repository fixed the issue.
如果有人和我有同样的问题——确保你没有从 Ubuntu 14.04 存储库安装到 12.04 机器上——它会给出同样的错误。从正确的存储库重新安装解决了该问题。
回答by weiyixie
this problem can be solved by installing the latest libstdc++.
这个问题可以通过安装最新的 libstdc++ 来解决。
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install libstdc++6-7-dbg
回答by nikc
This worked for me:
这对我有用:
cp <path_to>/libstdc++.so.6 $PWD
./<executable>
This tidbit came from @kerin (comment provided above):
这个花絮来自@kerin(上面提供了评论):
you might check out http://stackoverflow.com/questions/13636513/linking-libstdc-statically-any-gotchas
您可以查看http://stackoverflow.com/questions/13636513/linking-libstdc-statically-any-gotchas
From that link:
从该链接:
If you put the newer libstdc++.so in the same directory as the executable it will be found at run-time, problem solved.
如果将较新的 libstdc++.so 放在与可执行文件相同的目录中,它将在运行时找到,问题就解决了。
The error I was getting mentioned that libstdc++.so.6 was coming from /usr/lib64/, but this is not the library I linked against! The message looked like:
我提到的错误是 libstdc++.so.6 来自 /usr/lib64/,但这不是我链接的库!该消息如下所示:
<executing_binary>: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by <executing_binary>)
I did verify that LD_LIBRARY_PATH had the directory (and that it was the first path). For some reason at runtime it was still looking at /usr/lib64/libstdc++.so.6.
我确实验证了 LD_LIBRARY_PATH 具有目录(并且它是第一个路径)。出于某种原因,它在运行时仍在查看 /usr/lib64/libstdc++.so.6。
I took the advice from the article above and copied the libstdc++.so.6 from where I linked into the directory with my executable, ran from there, and it worked!
我接受了上面文章中的建议,并从我链接到可执行文件的目录中复制了 libstdc++.so.6,从那里运行,并且成功了!
回答by Serge Rogatch
Perhaps the answer to this question is of use here too: how to find libstdc++.so.6: that contain GLIBCXX_3.4.19 for RHEL 6?
也许这个问题的答案在这里也有用: 如何找到包含用于 RHEL 6 的 GLIBCXX_3.4.19 的 libstdc++.so.6: ?
curl -O http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6-4.7-dbg_4.7.2-5_i386.deb
ar -x libstdc++6-4.7-dbg_4.7.2-5_i386.deb && tar xvf data.tar.gz
mkdir backup
cp /usr/lib/libstdc++.so* backup/
cp ./usr/lib/i386-linux-gnu/debug/libstdc++.so.6.0.17 /usr/lib
ln -s libstdc++.so.6.0.17 libstdc++.so.6