是什么导致链接器仅给出“ld returned 1 exit status” 信息?
我正在对 ld 使用“--verbose”,试图获得一些对查找问题有用的信息,但它在打印正常的“--verbose”输出中打印错误消息:
[...blah - dump of linker script...]
attempt to open blah1.o succeeded
blah1.o
attempt to open blah2.o succeeded
blah2.o
[...blah - more opens that succeeded...]
attempt to open blah9.o succeeded
blah9.o
attemcollect2: ld returned 1 exit status
调用者:
gcc blah1.o [...blah...] blah9.o blahLib1.a blahLib2.a -g -lc -nostdlib -Wl,--warn-constructors -fpic -fno-pic -Wl,-q -Wl,-gc-sections -Wl,--verbose -T blahScript.ld -lm -o blahProgram.elf
I am using "--verbose" for ld in an attempt to get something useful for finding the problem, but it prints the error message amidst printing normal "--verbose" output:
[...blah - dump of linker script...]
attempt to open blah1.o succeeded
blah1.o
attempt to open blah2.o succeeded
blah2.o
[...blah - more opens that succeeded...]
attempt to open blah9.o succeeded
blah9.o
attemcollect2: ld returned 1 exit status
Invoked by:
gcc blah1.o [...blah...] blah9.o blahLib1.a blahLib2.a -g -lc -nostdlib -Wl,--warn-constructors -fpic -fno-pic -Wl,-q -Wl,-gc-sections -Wl,--verbose -T blahScript.ld -lm -o blahProgram.elf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Fwiw,我今天也遇到了同样的问题。 原因是磁盘空间不足。 在这种情况下,“ld”似乎只返回退出代码 1,根本不打印任何消息。 增加可用磁盘空间解决了该问题。
Fwiw, I got the same problem today. The cause was out of disk space. In this situation "ld" seems to just return an exit code 1, with no message printed at all. Increasing the available disk space fixed the problem.
这是一个一般性错误。 通常是由于对符号的未定义引用引起的。
我认为您不需要 --verbose 来查看错误。 在任何情况下 ld 都应该打印错误原因。 尝试在没有 --verbose 的情况下运行它,并仔细检查输出的每一行。
It's a generic error. Usually caused by undefined reference to a symbol.
I don't think you need --verbose to see the error. ld should print the cause of the error in any case. Try to run it without --verbose and carefully examine every line of the output.