编译iOS应用时,使用升压能见度链接器警告 [英] Visibility linker warnings when compiling iOS app that uses Boost
问题描述
我的iOS应用使用的库而这又取决于升压。虽然改造了的3rdParty构建系统,我遇到了连接器这样的警示
My iOS app uses a library which in turn depends on Boost. While revamping the 3rdparty build system, I encountered linker warnings such as this
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隐藏
和 -fvisibility - 内联隐藏
)。一个完整的重建后,我还是得到了警告。
I saw that there are quite a few other questions on SO regarding this warning. I followed their advice and made sure that the visibility settings in all builds are the same (-fvisibility=hidden
and -fvisibility-inlines-hidden
). After a full rebuild I still got the warnings.
环境:
- X code 4.6.0
- 的iOS SDK 6.1
- 采用了时下流行的的修改克隆galbraithjosephs-boostoniphone 构建脚本大厦升压
- 加速版本1.54.0
- 与
-std = C ++ 11 -stdlib = ++的libc
建筑
- Xcode 4.6.0
- iOS SDK 6.1
- Building Boost using a modified clone of the popular galbraithjosephs-boostoniphone build script
- Boost version 1.54.0
- Building with
-std=c++11 -stdlib=libc++
推荐答案
的问题是,所用的加速构建脚本铛++
作为编译器,但其他图书馆和我的自己的iOS应用中使用铛
(其他图书馆和我的应用程序在哪里建立与铛
)。
The problem was that the Boost build script used clang++
as the compiler, but the other library and my own iOS app used clang
(the other library and my app are Xcode projects where builds are made with clang
).
该警告消失后,我重建加强与铛
。
The warnings disappeared after I rebuilt Boost with clang
.
可悲的是,我完全不知道为什么,这有助于。据我所知,有铛++编译
切换到编译C ++模式下,开启/关闭特定设置。但它肯定不能意味着使用铛++
覆盖可见性设置是的明确的在命令行上指定的?评论或额外的答案解释的行为是受欢迎的。
The sad thing is that I don't know exactly why this helped. I am aware that compiling with clang++
switches the compiler into C++ mode, turning on/off certain settings. But it certainly can't mean that using clang++
overrides visibility settings that are explicitly specified on the command line?! Comments or additional answers explaining the behaviour are welcome.
这篇关于编译iOS应用时,使用升压能见度链接器警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!