How mavericks/xcode5.0.1 changed the compiler and linker?

老子叫甜甜 提交于 2020-02-02 13:38:50

问题


I upgraded a system from 10.8 to 10.9 and correspondingly for xcode from 5.0 to 5.0.1.

I'm rewarded when I try to run a part of my build that combines multiple .a files into a single, larger, shared lib:

Undefined symbols for architecture x86_64:
"__ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13find_first_ofEPKcmm", referenced from:             
__ZN2bt3fst12FstLookupSet14loadFromStringERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_ in libbtfst.a(bt_fst_factory.o)

That problem symbol, filtered, is:

__ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13find_first_ofEPKcmm
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find_first_of(char const*, unsigned long, unsigned long) const

The linking command line looks like:

libtool -macosx_version_min 10.6  -headerpad_max_install_names -dynamic -multiply_defined suppress -install_name `basename ../../../../rlp/lib/amd64-darwin12-xcode5/libbtutils.dylib` -o ../../../../rlp/lib/amd64-darwin12-xcode5/libbtutils.dylib -g   <long list of .a files>  -lstdc++.6 -lSystem

回答1:


It looks like you've compiled some of the objects using the newer libc++, which isn't supported under 10.6, and contradicts the library you are using during linking.

You can specify the library to use during a compile using -stdlib=libstdc++ and you also need to ensure you specify -mmacosx-version-min=10.6 during compilation, which might have the same effect, but explicitly declares the deployment target.



来源:https://stackoverflow.com/questions/19550436/how-mavericks-xcode5-0-1-changed-the-compiler-and-linker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!