私の iOS アプリは、Boost に依存するライブラリを使用しています。サードパーティのビルド システムを改良しているときに、このようなリンカの警告が表示されました。
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.
この警告に関して、SOには他にもかなりの数の質問があることがわかりました。私は彼らのアドバイスに従い、すべてのビルドの表示設定が同じであることを確認しました (-fvisibility=hidden
および-fvisibility-inlines-hidden
)。完全に再構築した後も、警告が表示されます。
環境:
- Xcode 4.6.0
- iOS SDK 6.1
- 人気のあるgalbraithjosephs-boostoniphoneビルド スクリプトの変更されたクローンを使用して Boost をビルドする
- ブーストバージョン 1.54.0
- で構築
-std=c++11 -stdlib=libc++