Apple Mach-O 链接器 (ld) 错误。 ld: -r 和 -dead-strip 不能一起使用

Apple Mach-O Linker (ld) Error. ld: -r and -dead-strip cannot be used together

XCode 5.0.1 在成功编译 161 个 C++ 项目文件后给我一个错误。 有很多 Apple Mach-O 链接器错误问题,但 none 帮助了我。

错误信息如下:

ld: -r and -dead_strip cannot be used together
clang: error: linker command failed with exit code 1
 (use -v to see invocation)

我的构建设置中的链接部分如下图所示:

Linker Section of XCode 5.0.1

谁能告诉我如何解决这个错误?

更新

当我将 Dead Code Stripping 设置为 No 时,我收到 19 个链接错误。对于 ReleaseDebugMach-O Type 设置为 Dynamic Library。 本例错误如下:

Undefined symbols for architecture x86_64:
      "boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<wchar    _t const*, std::basic_string<wchar_t, std::char_traits<wchar_t>,     std::allocator<wchar_t> > >,     std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<wchar_t     const*, std::basic_string<wchar_t, std::char_traits<wchar_t>,     std::allocator<wchar_t> > > > >, boost::regex_traits<wchar_t,     boost::cpp_regex_traits<wchar_t> >     >::construct_init(boost::basic_regex<wchar_t,     boost::regex_traits<wchar_t, boost::cpp_regex_traits<wchar_t> > > const&,     boost::regex_constants::_match_flags)", referenced from:
      boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<wchar_    t const*, std::basic_string<wchar_t, std::char_traits<wchar_t>,      std::allocator<wchar_t> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<wchar_t const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > >, boost::regex_traits<wchar_t, boost::cpp_regex_traits<wchar_t> > >::perl_matcher(__gnu_cxx::__normal_iterator<wchar_t const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, __gnu_cxx::__normal_iterator<wchar_t const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, boost::match_results<__gnu_cxx::__normal_iterator<wchar_t const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<wchar_t const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > > >&, boost::basic_regex<wchar_t, boost::regex_traits<wchar_t, boost::cpp_regex_traits<wchar_t> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<wchar_t const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >) in AdWrksTagDataFactory.o

错误信息如下:

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

在一些类似的问题中,我看到这可能是由于多个版本的 Boost 造成的,但我已经检查过了。

只需将 Dead Code Stripping 设置为 No。当此选项设置为 Yes 时,Xcode 将在链接期间添加 -dead_strip 标志,在链接可重定位二进制文​​件时 不支持