G++总是因对 _Unwind_GetIPInfo 的未定义引用而失败
我刚刚在我的 Asus EeePC 上网本上升级到 Ubuntu 11.04,并且遇到了 G++ 问题。使用 G++ 编译任何程序,即使是简单的“Hello World”,无论是使用 iostream、cstdio 还是 stdio.h,都会失败并显示消息:
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/libstdc++.so: undefined reference to `_Unwind_GetIPInfo@GCC_4.2.0'
collect2: ld returned 1 exit status
我使用 Synaptic 包管理器。在升级之前,Ubuntu 提供了 GCC 4.4,尽管我还通过另一个存储库安装了 GCC 4.5 (gcc-4.5)。 GCC 4.5 现在是 Ubuntu 11.04 中的默认版本。
我认为问题可能与 libgcc 有关。我尝试重新安装 GCC,但无法删除 libgcc:首先,Synaptic 包管理器报告某处有损坏的包,并停止了我的尝试;但我也注意到,要删除 libgcc 需要删除几乎所有应用程序,包括 apt 和 Firefox。
我还尝试了 gcc-snapshot 包;不幸的是,它给出了上面列出的相同错误。
有没有办法使用 Synaptic Package Manager 来获取最新的 G++ 工作版本?
I've just upgraded to Ubuntu 11.04 on my Asus EeePC netbook, and have a problem with G++. Compiling any program using G++, even a simple "Hello World", whether using iostream, cstdio, or stdio.h, fails with the message:
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/libstdc++.so: undefined reference to `_Unwind_GetIPInfo@GCC_4.2.0'
collect2: ld returned 1 exit status
I use Synaptic Package Manager. Before the upgrade, Ubuntu provided GCC 4.4, though I had also installed GCC 4.5 (gcc-4.5) via another repository. GCC 4.5 is now the default in Ubuntu 11.04.
I think the problem may be to do with libgcc. I tried reinstalling GCC, but I couldn't remove libgcc: first of all, Synaptic Package Manager, reported that there are broken packages somewhere, and stopped my attempt; but I also noted that to remove libgcc would require the removal of almost every application, including apt and Firefox.
I also tried the gcc-snapshot package; unfortunately, it gives the same error listed above.
Is there any way to use Synaptic Package Manager to obtain a recent, working version of G++?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关键词:--reinstall
添加所有您怀疑已损坏的软件包
The operative word: --reinstall
Add all package you suspect are corrupted
GCC-4.6 在
$LIBRARY_PATH
中发现了旧的、不兼容的 libgcc.a 版本;就我而言,它也是 $LIBRARY_PATH 中的第一个条目。该条目为 $G95/g95-install/lib/gcc-lib/i686-unknown-linux-gnu/4.0.3/ ,与 G95 Fortran 编译器相关。不久前,我自己在 .bash_profile 中完成了此操作,当时我经常将 C++ 程序链接到同一目录中的 libfortran.a 库。删除此条目解决了我的问题。将来我会在这种情况下使用 GCC 的 -L 开关。GCC-4.6 was finding an older, incompatible version of libgcc.a in
$LIBRARY_PATH
; in my case it was the also the first entry in$LIBRARY_PATH
. The entry was$G95/g95-install/lib/gcc-lib/i686-unknown-linux-gnu/4.0.3/
and relates to the G95 Fortran compiler. I had done this myself some time ago, in the .bash_profile, as I would, at that time, often link C++ programs to the libfortran.a library in that same directory. Removing this entry fixed my problem. In future I would use the -L switch to GCC for such situations.