c++iosxcodeboostlinker-warning

Linker warnings in xcode 6.4


I use c++ library projects (that uses boost 1.57 library) for my ios app and when I build my app i get hundreds of linker warnings. The app runs totally fine.

The prominent warning is

ld: warning: direct access in boost::exception_ptr boost::exception_detail::get_static_exception_object<boost::exception_detail::bad_exception_>() to global weak symbol boost::exception_ptr boost::exception_detail::get_static_exception_object<boost::exception_detail::bad_exception_>()::ep means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

How do i get rid of these linker warnings? Any possible way other than suppression?

Thanks


Solution

  • I got rid of these linker warnings by changing "Symbols hidden by default" to "YES" and "Inline Methods Hidden" to "YES" in xcode build settings.

    The boost library for iOS was built with -fvisibility=hidden -fvisibility-inlines-hidden flags and xcode build settings had symbols visibility set to YES. Hence there was a mismatch and linker warnings.