xcode – 来自链接器的奇怪警告(ld)

xcode – 来自链接器的奇怪警告(ld),第1张

概述参见英文答案 > xcode with boost : linker(Id) Warning about visibility settings                                    5个 我们正在构建一个主要使用Obj-C/C++ocoa编写的Mac OSX应用程序. 然后,应用程序静态链接一些第三方库,用C/C++编写并由我们编译(在命令行上,使用MacPort 参见英文答案 > xcode with boost : linker(Id) Warning about visibility settings                                    5个
我们正在构建一个主要使用Obj-C/C++ocoa编写的Mac OSX应用程序.
然后,应用程序静态链接一些第三方库,用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编译.
> ICU(libicudata,libicuuc,libicui18n),使用MacPorts编译.
> 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”的关系较少,更多的是与在所有项目中设置为相同的值有关.依赖于其他库的库/项目需要具有“默认隐藏的符号”的类似设置,以便正确链接并且没有错误/警告.

我之前遇到过这种情况,并且Xcode中的所有项目都进行了简单的更改,以确保设置匹配通常可以解决问题.既然听起来你也在编译命令行,那么gcc的-fvisibility参数就是你需要看的东西.

总结

以上是内存溢出为你收集整理的xcode – 来自链接器的奇怪警告(ld)全部内容,希望文章能够帮你解决xcode – 来自链接器的奇怪警告(ld)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1069243.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存