gpt4 book ai didi

c++ - ___sincos_stret 链接时 undefined symbol

转载 作者:IT老高 更新时间:2023-10-28 22:35:22 26 4
gpt4 key购买 nike

就像之前提到的 here , ___sincos_stret 在使用 Xcode5 命令行工具编译使用此符号的项目时找不到。

在上面引用的线程中,针对 IOS 目标发布了解决方案(将 -miphoneos-version-min=5.0 传递给编译器),是否有桌面解决方案(x64) 目标?

例如,当我尝试编译 polycode 时会发生这种情况.

编辑 2:

奇怪的是,在手动编译上一个错误中引用的库后,错误现在恰好位于 lto.o ,这是一个内部 llvm header 本身...

undef: ___sincos_stret
Undefined symbols for architecture x86_64:
"___sincos_stret", referenced from:
_mdct_init in lto.o
_dradfg in lto.o

我正在运行带有 Xcode 5 的 OSX 10.9 DP。This is the link step .

最佳答案

stret 是 Apple 所说的“返回结构”。 ___sincos_stret 是 LLVM 优化 - 如果您编写的代码调用 sin(n) 然后 cos(n) 并使用这两个结果然后编译器将调用返回结构的 sincos 方法,接收一个包含两个东西的结构。如果操作数相同,一次计算比单独计算要快。

在粗略的浏览中,我在 initInterTab2D 中看不到 sincos,但我预计某些内容正在被内联。

一边摸索一边尝试:

cd /Applications/Xcode.app/Contents/Developer/Platforms 
grep -lr ___sincos_stret *

通过该方法并在可能的结果上使用 nm,我发现 ___sincos_stret 函数在 iOS 7.0 和 OS X 10.9 中作为其 的一部分公开libsystem_m.dylibs。例如。如果您的 Xcode 安装在默认位置,请尝试:

nm /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/system/libsystem_m.dylib | grep sincos

和/或:

nm /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/system/libsystem_m.dylib | grep sincos

您会在其中任何一个中看到该符号。所以正确的解决方案是在 Xcode 中设置一个较旧的部署目标,或者在您的 makefile 中执行等效操作。

关于c++ - ___sincos_stret 链接时 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19015780/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com