我的 iOS 应用程序使用了一个依赖于 Boost 的库。在修改 3rdparty 构建系统时,我遇到了这样的链接器警告
ld: warning: direct access in ___cxx_global_var_init to global weak symbol
std::__1::basic_ofstream<char, std::__1::char_traits<char> >::~basic_ofstream()
means the weak symbol cannot be overridden at runtime.
This was likely caused by different translation units being compiled with different visibility settings.
还有这个
ld: warning: direct access in __GLOBAL__I_a to global weak symbol
boost::exception_ptr::~exception_ptr()
means the weak symbol cannot be overridden at runtime.
This was likely caused by different translation units being compiled with different visibility settings.
我看到关于这个警告还有很多其他问题。我听从了他们的建议,并确保所有构建中的可见性设置都是相同的(-fvisibility=hidden
和-fvisibility-inlines-hidden
)。完全重建后,我仍然收到警告。
环境:
- Xcode 4.6.0
- iOS SDK 6.1
- 使用流行的 galbraithjosephs-boostoniphone构建脚本的修改克隆构建 Boost
- 提升版本 1.54.0
- 建筑与
-std=c++11 -stdlib=libc++