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

问题:

./a.out: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/ycai/x10/stdlib/lib/libx10.so)


可能的解决方案:

第一种方案:

执行strings /usr/lib64/libstdc++.so.6 | grep GLIBC


返回结果没有GLIBCXX_3.4.9

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
GLIBC_2.0
GLIBC_2.3
GLIBC_2.4
GLIBC_2.3.4
GLIBC_2.1
GLIBC_2.1.3
GLIBC_2.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

执行ls -l  /usr/lib64/libstdc++.so.6
发现/usr/lib64/libstdc++.so.6 -> /usr/lib/libstdc++.so.6.0.8,其实这里需要使用libstdc++.so.6.0.10
从网上下载这个文件,然后把/usr/lib/libstdc++.so.6 -> /usr/lib/libstdc++.so.6.0.8(rm -rf /usr/lib/libstdc++.so.6 )软链接删除,重新做
ln -s /usr/lib/libstdc++.so.6.0.10  /usr/lib64/libstdc++.so.6


补充这个解决方案是网上找的,这个解决方案生效的前提是要有权限。我是在集群上使用的,没有管理员权限,所以无法删除上面所说软连接。


第二种方案(此种方案成功)

The problem is that you built your new GCC incorrectly: on Linux you should use

./configure --prefix=/usr

The default installation prefix is /usr/local, which is why make install put gcc and g++binaries into /usr/local/bin, etc.

What's happening to you now is that you compile and link using the new (symlinked) GCC 4.2.4, but at runtime your program binds to the old /usr/lib64/libstdc++.so.6 (version 6.0.8, instead of required 6.0.9). You can confirm that by running ldd build/ALPHA_SE/m5.opt: you should see that it uses /usr/lib64/libstdc++.so.6.

There are several fixes you could do.

env LD_LIBRARY_PATH=/usr/local/lib64 ldd build/ALPHA_SE/m5.opt

should show you that setting LD_LIBRARY_PATH is sufficient to redirect the binary to correct library, and

LD_LIBRARY_PATH=/usr/local/lib64 build/ALPHA_SE/m5.opt

should just run. You could "bake" this path into m5.opt binary by relinking it with -Wl,-rpath=/usr/local/lib64.

关键点是:

输入

env LD_LIBRARY_PATH=/home/ycai/opt/gcc-4.5.1/lib64 ldd ./a.out 

运行后,就发现那个连接对了。

参考上面对的链接,将/home/ycai/opt/gcc-4.5.1/lib64等路径加入到LD_LIBRARY_PATH里面。
LD_LIBRARY_PATH=/home/ycai/opt/gcc-4.5.1/lib64 ldd ./a.out


第三种方案:

cd /usr/lib64 && mv libstdc++.so.6 libstdc++.so.6_bak &&
ln -s /home/ycai/opt/gcc-4.5.1/lib64/libstdc++.so.6

这种方案可能也需要一定的权限


第四种方案:

   重新配置。reconfigure the new GCC with --prefix=/usr, and then make all install.

   详见:http://stackoverflow.com/questions/1952146/glibcxx-3-4-9-not-found


五:

可以参考此文章:http://blog.csdn.net/wangxmin2005/article/details/8211077

如果有管理员权限,根据此文章应该是可以解决问题的。(PS:我的问题就是没有权限~~~~(>_<)~~~~ )


参考文章:

http://blog.csdn.net/atower_boy/article/details/6268838

http://jamesbond0479.blog.163.com/blog/static/24147582010712104140781/

http://stackoverflow.com/questions/1952146/glibcxx-3-4-9-not-found


没有更多推荐了,返回首页