“bad codegen,boost diff中的指针diff” 32位构建中的错误 [英] "bad codegen, pointer diff in boost" 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
我发现的唯一解决方法是使用g ++ - 4.0的32位构建。我尝试的其他编译器(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.
这篇关于“bad codegen,boost diff中的指针diff” 32位构建中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!