程序链接在使用自定义构建的gcc时失败 [英] program linking fails when using custom built gcc

查看:1525
本文介绍了程序链接在使用自定义构建的gcc时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行fedora 21发行版,其中默认的gcc是4.9。
我有一个定制的gcc / g ++ 4.8在/ usr / local / gcc48(例如,cuda要求gcc =< 4.8,我使用update-alternatives选择这个)
现在,我已经得到了一个源代码,它使用vtk库和其他人。如果我使用默认gcc 4.9,cmake和make工作正常。
然而,当使用gcc48时,我得到:

  /usr/lib64/vtk/libvtkCommonDataModel.so.1: référenceindéfinievers«std :: __ throw_out_of_range_fmt(char const *,...)@ GLIBCXX_3.4.20»
/lib64/libicuuc.so.52:référenceindéfinievers«__cxa_throw_bad_array_new_length@CXXABI_1.3.8»
collect2 :erreur:ld aretourné1 code d'étatd'exécution
CMakeFiles / main.dir / build.make:365:目标'../bin/main'失败的食谱
make [2] :*** [../bin/main]错误1
CMakeFiles / Makefile2:60:目标'CMakeFiles / main.dir / all'失败的食谱
make [1]:*** [ CMakeFiles / main.dir / all]错误2
Makefile:76:目标'all'失败的食谱
make:*** [all]错误2

我明白这是一个链接器错误,我试图指向LD_LIBRARY_PATH = / usr / local / gcc48 / lib或LD_LIBRARY_PATH = / usr / local / gcc48 / lib>



这里有什么问题?

解决方案

如果您以英文发布错误讯息,将会很有帮助。



看起来未定义的符号是 __ cxa_throw_bad_array_new_length 。函数 __ cxa ...来自C ++运行时库。 G ++通常附带这个库的自己的版本,叫做 libsupc ++ 。我猜猜,定制的G ++不能找到这个库,或者发出一个引用不是在新的(4.9) libsupc ++ 的符号。尝试编译随您的自定义版本的G ++一起提供的 libsupc ++ 源,并指向链接器。您可能还需要为 libstdc ++ 执行此操作。


I'm running a fedora 21 distribution, in which the default gcc is 4.9. I have a custom built gcc/g++ 4.8 in /usr/local/gcc48 (for instance, cuda requires gcc =< 4.8, and i use update-alternatives to chose this one) I have been compiling a few small programs with this version 4.8 without problem so far.

Now, I have been given a source code which makes uses of vtk libraries and others. If I use default gcc 4.9, cmake and make work fine. However, when using gcc48, I get:

/usr/lib64/vtk/libvtkCommonDataModel.so.1: référence indéfinie vers « std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20 »
/lib64/libicuuc.so.52: référence indéfinie vers « __cxa_throw_bad_array_new_length@CXXABI_1.3.8 »
collect2: erreur: ld a retourné 1 code d'état d'exécution
CMakeFiles/main.dir/build.make:365: recipe for target '../bin/main'   failed
make[2]: *** [../bin/main] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/main.dir/all' failed
make[1]: *** [CMakeFiles/main.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

I understand that is it a linker error, I tried to point LD_LIBRARY_PATH=/usr/local/gcc48/lib or LD_LIBRARY_PATH=/usr/local/gcc48/lib64, but i'm stuck.

What is the problem here ?

Thanks

解决方案

It would be helpful if you post the error message in English.

It appears that the undefined symbol is __cxa_throw_bad_array_new_length. The functions __cxa... come from the C++ runtime library. G++ usually ships with it's own version of this library, called libsupc++. I would guess that the custom-built G++ can not find this library or is emitting a reference to a symbol which is not in the newer (4.9) libsupc++. Try compiling the libsupc++ source that ships with your custom version of G++ and directing the linker toward it. You may also need to do this for libstdc++.

这篇关于程序链接在使用自定义构建的gcc时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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