开发者

Xcode4: "bad codegen, pointer diff" linker error again

This question is related to this: "bad codegen, pointer diff" linker error with Xcode 4 and "bad codegen, pointer diff in boost" error in 32-bit build and XCode 3开发者_运维知识库.2.6 and 4 linker errors ld:bad codegen, pointer diff in ... to global weak symbol

I am currently upgrading all my projects to Xcode4 and I am experiencing some weirdness.- The above error only occurs if I build a universal binary or the 32-bit version. If I stick to 64 bit only, things work fine. I am building a custom static library myself, where right now I don't use any visibility settings (i.e. attribute ((visibility ("default")))) in that code. If I link that library and try to build the project, the exact error is:

ld: bad codegen, pointer diff in Motor::Core::DefaultStoragePolicy::DefaultStoragePolicy(myWindowContent* const&)to global weak symbol Motor::Core::NullPointerException::~NullPointerException()for architecture i386

It is located in my SmartPtr class which can throw a NullPointerException (just derives from std::exception). If I explicitly set the visibility of the NullPointerException class to hidden, things compile fine, but hiding an exception can't be good! I tried the following compilers: GCC 4.2, LLVM-GCC 4.2 and LLVM 2.1 all with the same problem. Setting Symbols Hidden By Default to yes in he project/target settings didn't work (and is also not what I want). So how can I solve this without hiding my exceptions (which is nonsense). Do I have to live with it, is it a bug? Looking forward to you ideas, thanks!


Okay, I found the error, I had Inline Methods Hidden set to yes in my application while it was set to no when building my static library. so if you encounter the same problem, make sure that you have Inline Methods Hidden set to No. Now my code also works with Symbols Hidden By Default set to no, which is what I want!

Still it is a mystery to me why the error only shows up in 32-bit build.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜