Apple Mach-O链接器(id)警告:为MacOSX构建,但是针对为iOS构建的dylib进行链接 [英] Apple Mach-O linker (id) warning : building for MacOSX, but linking against dylib built for iOS
问题描述
从过去xCode 4的某个点开始抱怨链接器问题:
Starting from some point in the past xCode 4 in complaining about linker problems:
ld:警告:为MacOSX构建,但链接对建为
的iOS dylib:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks//CoreGraphics.framework/CoreGraphics
ld: warning: building for MacOSX, but linking against dylib built for iOS: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks//CoreGraphics.framework/CoreGraphics
我已经检查了所有内容,但配置中仍然没有任何可疑信息,它编译并运行。
在CoreGraphics.framework之前我唯一能看到的是双斜线,为什么我不知道。尝试删除并在构建阶段上再次添加库,但没有帮助。
I have checked everything but still nothing suspicious in the config and it compiles and runs. The only thing that I see it is double slashes before CoreGraphics.framework, why I do not know. Tried remove and add again library on "Build phases" that did not help.
推荐答案
有时通过查看调试Xcode问题更容易在它正在使用的命令行的构建日志中。
Sometimes it's easier to debug Xcode problems by looking at the build log for the command lines it's using.
如果从命令行构建,如果未指定,则可以获取该消息-miphoneos-version-min =
If you're building from the command line, you can get that message if you don't specify -miphoneos-version-min=
This compiles:
(where conftest.c just contains int main() {})
/Applications/Xcode5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -miphoneos-version-min=6.0 conftest.c
And this gives the error:
/Applications/Xcode5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk conftest.c
ld: building for MacOSX, but linking against dylib built for iOS Simulator file '/Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/lib/libSystem.dylib' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这篇关于Apple Mach-O链接器(id)警告:为MacOSX构建,但是针对为iOS构建的dylib进行链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!