链接错误 __stack_chk_fail (在 xcode 中使用库)
我正在尝试使用 gcc 4.0 和 10.4u SDK 在 xcode 中编译 C++ 应用程序。
我收到以下链接器错误。
“_stack_chk_fail”,引用自: libAudioDecoder.a(stream_decoder.o) 中的_read_frame_ libAudioDecoder.a(stream_decoder.o) 中的_read_metadata_ “_stack_chk_guard”,引用自: libAudioDecoder.a(stream_decoder.o) 中的 ___stack_chk_guard$non_lazy_ptr (也许你的意思是:___stack_chk_guard$non_lazy_ptr) ld: 未找到符号
其他帮助线程表明我需要做的就是添加...
-fno-stack-protector
...到“其他 C 标志”,这就是我所做的,但是问题仍然存在。我已经完成了清理、重建,甚至重新启动了 XCode(因为已知它有时会感到困惑),但问题仍然存在。
请注意,libAudioDecoder 是我自己尝试链接的库。 Stream_decoder.o 是 libAudioDecoder 链接到的 FLAC 库的一部分。
本质上,我的项目与 libAudioDecoder 链接,而 libAudioDecoder 与 libFlac 链接,其中 libFlac 也已使用 xcode 项目进行编译。
对于每三个 xcode 项目,我使用 gcc 4.0 和 10.4u SDK,并使用 -fno-stack-protector 设置“其他 C 标志”和“其他 C++ 标志”。
我现在没有想法,所以希望能得到一些帮助。
干杯。
I'm trying to compile a C++ app in xcode using gcc 4.0 and and the 10.4u SDK.
I get the following linker error.
"_stack_chk_fail", referenced from:
_read_frame_ in libAudioDecoder.a(stream_decoder.o)
_read_metadata_ in libAudioDecoder.a(stream_decoder.o)
"_stack_chk_guard", referenced from:
___stack_chk_guard$non_lazy_ptr in libAudioDecoder.a(stream_decoder.o)
(maybe you meant: ___stack_chk_guard$non_lazy_ptr)
ld: symbol(s) not found
Other help threads suggest that all I need to do is add...
-fno-stack-protector
...to the 'Other C Flags', which is what I've done, but the problem persists. I've done cleans, rebuilds and even restarted XCode (because it's been known to get confused sometimes), but the problem persists.
Note that libAudioDecoder is my own library that I'm trying to link with. stream_decoder.o is apart of the FLAC library which libAudioDecoder links to.
Essentially my project links with libAudioDecoder which links with libFlac, where libFlac has also been compile using an xcode project.
For each three xcode projects, I'm using gcc 4.0 and and the 10.4u SDK and have 'Other C Flags' and 'Other C++ Flags' set with -fno-stack-protector.
I'm all out of ideas at the moment, so would appreciate some help with this.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
符号
_stack_chk_fail
是从libAudioDecoder.a
库中的符号_read_frame_
引用的,而不是从您链接到libAudioDecoder 的 Xcode 项目。一个。尝试返回并使用
-fno-stack-protector
标志重建libAudioDecoder.a
?听起来您可能已经编译了链接到较新版本的 libc 的库,而现在正在使用旧版本进行编译,或者出现其他类似的不匹配情况。在 StackOverflow 上搜索“
_stack_chk_fail
”将引导您找到大量其他提示。Symbol
_stack_chk_fail
is referenced from symbol_read_frame_
in yourlibAudioDecoder.a
library, not the Xcode project from which you are linking againstlibAudioDecoder.a
. Try to go back and rebuildlibAudioDecoder.a
with the-fno-stack-protector
flag?It sounds like you may have compiled the library linking against a newer version of
libc
and are now compiling with an older version, or some other mismatch like that. Searching for "_stack_chk_fail
" on StackOverflow will lead you to a ton of other tips.