ld:无法识别的选项'--push-state--no-needed' [英] ld: unrecognized option '--push-state--no-as-needed'

查看:403
本文介绍了ld:无法识别的选项'--push-state--no-needed'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的构建失败,并显示以下链接器错误消息:

My build fails with the following linker error message:

失败::&& /usr/bin/g ++ -Wall -Wextra -Werror -g -fsanitize =未定义,地址-Wno未使用参数-fsanitize =未定义,地址-rdynamic * .o -o SCE -Wl,-rpath,/opt/qt59 /lib/opt/qt59/lib/libQt5Widgets.so.5.9.1/usr/local/lib/libprotobuf.a -lpthread -lutil -lgrpc ++/opt/qt59/lib/libQt5Gui.so.5.9.1/opt/qt59 /lib/libQt5Core.so.5.9.1&& :
/usr/bin/x86_64-linux-gnu-ld:无法识别的选项'--push-state--no-ne-needed'

FAILED: : && /usr/bin/g++ -Wall -Wextra -Werror -g -fsanitize=undefined,address -Wno-unused-parameter -fsanitize=undefined,address -rdynamic *.o -o SCE -Wl,-rpath,/opt/qt59/lib /opt/qt59/lib/libQt5Widgets.so.5.9.1 /usr/local/lib/libprotobuf.a -lpthread -lutil -lgrpc++ /opt/qt59/lib/libQt5Gui.so.5.9.1 /opt/qt59/lib/libQt5Core.so.5.9.1 && :
/usr/bin/x86_64-linux-gnu-ld: unrecognized option '--push-state--no-as-needed'

您可以在此处查看完整的构建日志.错误出现在2211行中,版本打印在2104ff行中.

You can see the full build log here. The error is in line 2211 and versions are printed in lines 2104ff.

哪个工具导致错误?

  • gcc 7.3.0是否使用了错误的链接器标志? ld文档表示--push-state是单独的命令.
  • ld 2.28是否太旧,无法理解链接器标志?
  • Is gcc 7.3.0 using an incorrect linker flag? The ld documentation indicates that --push-state and --no-as-needed are separate commands.
  • Is ld 2.28 too old to understand the linker flag? The change log doesn't list anything that seems related.
  • The command && /usr/bin/g++ looks odd, it should be /usr/bin/g++. Using make instead of ninja shows the same linking error.

它在同时使用gcc 7.3.0ld 2.30的Debian测试中正确构建,但是对于Ubuntu Trusty来说似乎没有有效的binutils-2.30 ppa.

It builds correctly on Debian testing which is using gcc 7.3.0 as well and ld 2.30, but there doesn't seem to be a working binutils-2.30 ppa for Ubuntu Trusty.

如何在Travis上成功构建项目?

How do I successfully build my project on Travis?

推荐答案

GCC 7已通过 Ubuntu工具链测试PPA (适用于16.04)获得. .1和14.04).

GCC 7 is fixed with 7.3.0-16ubuntu3 (tested on Ubuntu 18.04). This version is available though the Ubuntu Toolchain Test PPA (for 16.04.1 and 14.04).

仅通过Make进行了测试,但它也可以与Ninja一起使用.启用了Sanitizer,ASan和UBsan.

Tested with Make only, but it should work with Ninja too. Both Sanitizer, ASan and UBsan, enabled.

更改日志尽管

gcc-7(7.3.0-16ubuntu3)仿生; urgency = medium

gcc-7 (7.3.0-16ubuntu3) bionic; urgency=medium

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆