<错误的代码生成,boost中的指针diff&" 32位版本中的错误 [英] &quot;bad codegen, pointer diff in boost&quot; error in 32-bit build
问题描述
在Mac OS X 10.6下,我正在构建一个链接到boost 1.46的C ++共享库.我正在使用随Xcode 4.0一起安装的命令行工具.
Under Mac OS X 10.6 I am building a C++ shared library which links to boost 1.46. I am using the command line tools installed with Xcode 4.0.
64位版本可以正常工作.当构建32位时,在链接时出现以下错误消息:
The 64-bit build works fine. When building for 32-bit, I get the following error message upon linking:
ld: bad codegen, pointer diff in boost::detail::sp_counted_base::sp_counted_base()to global weak symbol vtable for boost::detail::sp_counted_basefor architecture i386
我发现的唯一解决方法是对32位版本使用g ++-4.0.我尝试过的其他编译器(g ++-4.2,llvm-g ++-4.2和clang ++)都产生上述错误.
The only workaround I found is to use g++-4.0 for the 32-bit build. The other compilers I tried (g++-4.2, llvm-g++-4.2 and clang++) all produce the error above.
推荐答案
该问题似乎已随XCode 4.2一起安装的链接器中得到解决.链接后,我现在收到警告而不是错误消息:
The problem seems to be fixed in the linker that is installed with XCode 4.2. Upon linking I now get a warning instead of the error message:
ld: warning: direct access in __ZN5boost6detail15sp_counted_baseC2Ev to global weak symbol __ZTVN5boost6detail15sp_counted_baseE means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
这篇关于<错误的代码生成,boost中的指针diff&" 32位版本中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!