未找到GLIBCXX_3.4.9 [英] GLIBCXX_3.4.9 not found

查看:175
本文介绍了未找到GLIBCXX_3.4.9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于libstdc ++的问题。so。



我安装了一个新版本的gcc并试图编译c ++代码。编译工作,但当我尝试执行二进制文件(m5.opt是它的名字)时,我得到了以下错误:
build / ALPHA_SE / m5.opt:/usr/lib64/libstdc++.so.6 :版本'GLIBCXX_3.4.9'找不到(需要build / ALPHA_SE / m5.opt)。

我需要替换libstdc ++。so?如果是这样,我可以在哪里下载我想要的版本?在GCC网站上,他们说libstdc ++现在是gcc的一部分。



我希望有人能帮助我!我现在只用了4个月的时间,所以对我来说一切都很新。



最大值

详情



GCC:

我之前有gcc 4.1.2,但是我下载了gcc 4.2.4。从我执行./configure的untarred gcc-directory; 使; sudo make install。
当我尝试使用gcc或g ++编译时,它的默认版本仍然是4.1.2。为了克服这个问题,我更换了一些链接:

mv / usr / bin / gcc / usr / bin / gcc_bak

ln -s / usr / local / bin / gcc gcc <
mv / usr / bin / g ++ / usr / bin / g ++ _ bak

ln -s / usr / local / bin / g ++ g ++



GLIBC(++) - libstdc ++:

/usr/lib64/libstdc++.so.6 - > libstdc ++。so.6.0.8 />
/usr/local/lib/libstdc++.so - > libstdc ++。so.6.0.9

/lib/libc.so.6 - > libc-2.5.so - >

Linux版本:

uname -a给出:
Linux madmax 2.6.18 -128.4.1.el5#1 SMP Tue Aug 8 12:51:10 EDT 2009 x86_64 x86_64 x86_64 GNU / Linux

解决方案

问题在于你错误地构建了新的 GCC :在Linux上,你应该使用

  ./ configure --prefix = / usr 

默认安装前缀是 / usr / local ,这就是为什么 make install 放置 gcc g ++ 二进制文件转换为 / usr / local / bin 等。



现在发生的事情是您使用新的(符号链接) GCC编译和链接4.2.4 ,但是在运行时,程序绑定到旧的 / usr / lib64 / libstdc ++。so.6 (版本6.0.8,而是的要求6.0.9)。您可以通过运行 ldd build / ALPHA_SE / m5.opt 来确认:您应该看到它使用 / usr / lib64 / libstdc ++。so.6

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

应该告诉你设置 LD_LIBRARY_PATH 足以将二进制文件重定向到正确的库,并且

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

应该赶紧跑。你可以通过用 -Wl,-rpath = / usr / local / lib64 重新链接它来将此路径烘焙为m5.opt二进制文件。



一个更持久的解决方案是修复库,就像修复二进制文件一样:

  cd / usr / lib64&& mv libstdc ++。so.6 libstdc ++。so.6_bak&& 
ln -s /usr/local/lib64/libstdc++.so.6。

更好的解决方案是重新配置新的 GCC with --prefix = / usr ,然后 make all install 。


I have a problem concerning libstdc++.so.

I installed a new version of gcc and tried to compile c++ code. The compiling worked, but when I try to execute the binary (m5.opt is its name) I've got the following error: build/ALPHA_SE/m5.opt: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by build/ALPHA_SE/m5.opt).

Do I need to replace libstdc++.so? And if so, where can I download the version I want? On the GCC-website they say libstdc++ is a part of gcc now.

I hope somebody can help me out! I'm only 4 months on Linux now, so everything is very new for me.

Max

details

GCC:
I had gcc 4.1.2 before, but I downloaded gcc 4.2.4. From the untarred gcc-directory I executed "./configure"; "make"; "sudo make install". When I tried to use gcc or g++ to compile, it's default version was still 4.1.2. To overcome this I replaced some links:
mv /usr/bin/gcc /usr/bin/gcc_bak
ln -s /usr/local/bin/gcc gcc
mv /usr/bin/g++ /usr/bin/g++_bak
ln -s /usr/local/bin/g++ g++

GLIBC(++) -- libstdc++:
/usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.8
/usr/local/lib/libstdc++.so -> libstdc++.so.6.0.9
/lib/libc.so.6 -> libc-2.5.so -> libc-2.5.so

Linux-version:
uname -a gives: Linux madmax 2.6.18-128.4.1.el5 #1 SMP Tue Aug 4 12:51:10 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

解决方案

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.

A more permanent solution is to fix the libraries the same way you fixed the binaries:

cd /usr/lib64 && mv libstdc++.so.6 libstdc++.so.6_bak &&
ln -s /usr/local/lib64/libstdc++.so.6 .

An even better solution is to reconfigure the new GCC with --prefix=/usr, and then make all install.

这篇关于未找到GLIBCXX_3.4.9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆