然后,该应用程序与一些第三方库以静态方式链接,由C/C++编写,并由我们编译(在命令行中,使用MacPorts或通常的“./configure&& make”;都是通用二进制文件)。
该应用程序正常工作,但广告编译时我们总是得到这些奇怪的链接器警告:
ld: warning: direct access in ___cxx_global_var_init17 to global weak symbol __ZGVN4i18n12phonenumbers9SingletonINS0_15PhoneNumberUtilEE8instanceE 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 ___cxx_global_var_init17 to global weak symbol __ZGVN4i18n12phonenumbers9SingletonINS0_15PhoneNumberUtilEE8instanceE 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 ___cxx_global_var_init17 to global weak symbol __ZN5boost10scoped_ptrIN4i18n12phonenumbers15PhoneNumberUtilEED1Ev 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 ___cxx_global_var_init17 to global weak symbol __ZN4i18n12phonenumbers9SingletonINS0_15PhoneNumberUtilEE8instanceE 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 ___cxx_global_var_init17 to global weak symbol __ZGVN4i18n12phonenumbers9SingletonINS0_15PhoneNumberUtilEE8instanceE means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
这来自一个C/C++库。我们正在与这些库链接:
> libphonenumber,这是导致5个警告中的4个的显然。由我们通过“cmake”编译。
boost(libboost_thread-mt),负责1警告。与MacPorts编译。
>使用MacPorts编译的ICU(libicudata,libicuuc,libicui18n)。
> Protocol Buffers,通过“./configure&& make”编译。
请注意:
>尽管有警告,应用程序仍然运行正常,但我们希望能够摆脱这些问题,因为它们令人讨厌。
> xcode with boost : linker(Id) Warning about visibility settings提出的解决方案不起作用:“默认隐藏的符号”一直是“是”。
解决方法
The solution proposed by xcode with boost : linker(Id) Warning about
visibility settings doesn’t work: “Symbols hidden by default” has
always been “YES”.
这与设置为“YES”的更少关系,更重要的是在所有项目中设置为相同的值。依赖于其他库的Libs /项目需要具有“默认隐藏的符号”的同样设置,以便正确链接并且没有错误/警告。
我以前遇到过,所有项目的Xcode都有一个简单的改变,以确保设置匹配通常可以解决问题。由于这听起来像在编译命令行,gcc的可见性参数是你需要看的。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。