C++ /usr/lib/libstdc++.so.6:未找到版本“GLIBCXX_3.4.15”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5216399/
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
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
提问by Chris
How can I get GLIBCXX_3.4.15 in Ubuntu? I can't run some programs that I'm compiling.
如何在 Ubuntu 中获得 GLIBCXX_3.4.15?我无法运行我正在编译的一些程序。
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!
谢谢你的帮助!
采纳答案by Chris
I'm compiling gcc 4.6 from source, and apparently
我正在从源代码编译 gcc 4.6,显然
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.
我将它复制到 /usr/lib 并重定向 libstdc++.so.6 以指向新的,现在一切正常。
回答by Martin G
I have been avoiding this issue in the past by simply linking libstdc++ statically with this parameter sent to g++ when linking my executable:
过去我一直通过在链接我的可执行文件时简单地将 libstdc++ 与发送给 g++ 的参数静态链接来避免这个问题:
-static-libstdc++
If linking in the library statically is an option this is probably the quickest work-around.
如果静态链接库中是一个选项,这可能是最快的解决方法。
回答by Hobo
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).
我试图让 clang 工作(这也需要 6.0.15),在四处寻找时我发现它安装在/usr/local/lib/libstdc++.so.6.0.15
. 当我安装石墨(一个实验性的 gcc 版本)时,它安装在那里。
If you need access to libraries at that location, then you'll need to define LD_LIBRARY_PATH
as:
如果您需要访问该位置的库,则需要定义LD_LIBRARY_PATH
为:
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64
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.
这样做后,我能够让叮当声工作。希望这对某人有帮助。
回答by Cheng Chang
I encounter this problem when trying to use matlab eng to call m functions from c code.
which occurs with command mex -f .. ..
我在尝试使用 matlab eng 从 c 代码调用 m 函数时遇到了这个问题。与命令一起发生mex -f .. ..
My solution:
我的解决方案:
strings /usr/lib/i386-<tab>/libstdc++.so.6 | grep GLIBC
I found it includes 3.4.15
我发现它包括 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
问题来自 matlab 本身,它从调用自己的 libstdc++.so.6 {MATLAB}/bin
so, just replace it with the updated system lib.
因此,只需将其替换为更新的系统库即可。
回答by iueae
I got same error. This is how it worked for me:
我有同样的错误。这对我来说是这样的:
- cleaned the project under currently installed gcc
- recompiled it
- 清理了当前安装的 gcc 下的项目
- 重新编译它
Worked perfectly!
完美地工作!
回答by crazyLinux
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).
对于这个错误,我从其他服务器复制了最新的libstdc++.so.6.0.17,去掉了软链接,重新创建。
1. 将 libstdc++.so.6.0.15 或最新版本从其他服务器复制到受影响的系统。
就我而言,SUSE linux 11 SP3 是最新的。
2. rm libstdc++.so.6
3. ln -s libstdc++.so.6.0.17 libstdc++.so.6(在/usr/lib64目录下)。
nJoy
nJoy
回答by Arsen
I have just faced with similar issue building LLVM 3.7 version. first check whether you have installed the required library on your system:
我刚刚在构建 LLVM 3.7 版本时遇到了类似的问题。首先检查您的系统上是否安装了所需的库:
$locate libstdc++.so.6.*
Then add the found location to your $LD_LIBRARY_PATH environment variable.
然后将找到的位置添加到 $LD_LIBRARY_PATH 环境变量中。
回答by prmottajr
I've extracted them from an RPM (RPM for libstdc++) and then:
我已经从 RPM(用于 libstdc++的 RPM)中提取了它们,然后:
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.
设置系统搜索当前目录下的库。然后就执行了我的程序。但就我而言,我收到了我需要的单个可执行文件,这不是系统范围的更改。
回答by Gili
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:
有时您无法控制目标机器(例如,您的库需要在锁定的企业系统上运行)。在这种情况下,您需要使用与其 GLIBCXX 版本相对应的 GCC 版本重新编译您的代码。在这种情况下,您可以执行以下操作:
- Look up the latest version of GLIBCXX supported by the target machine:
strings /usr/lib/libstdc++.so.6 | grep GLIBC
... Say the version is3.4.19
. - Use https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.htmlto find the corresponding GCC version. In our case, this is
[4.8.3, 4.9.0)
.
- 查找目标机器支持的最新版本的 GLIBCXX:
strings /usr/lib/libstdc++.so.6 | grep GLIBC
... 说版本是3.4.19
. - 使用https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html查找对应的 GCC 版本。在我们的例子中,这是
[4.8.3, 4.9.0)
.
回答by Favoorr
gcc version 4.8.1, the error seems like:
gcc 4.8.1 版,错误如下:
/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)
/root/bllvm/build/Release+Asserts/bin/llvm-tblgen:/usr/lib64/libstdc++.so.6:未找到版本‘GLIBCXX_3.4.15’(/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
我在编译gcc 4.8.1的地方找到了libstdc++.so.6.0.18
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.
问题解决了。