Apple Mach-O 链接器(id)警告:为 MacOSX 构建,但链接到为 iOS 构建的 dylib [英] Apple Mach-O linker (id) warning : building for MacOSX, but linking against dylib built for iOS

查看:17
本文介绍了Apple Mach-O 链接器(id)警告:为 MacOSX 构建,但链接到为 iOS 构建的 dylib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从过去 xCode 4 开始抱怨链接器问题:

Starting from some point in the past xCode 4 in complaining about linker problems:

ld:警告:为 MacOSX 构建,但链接到为构建的 dylibIOS:/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屋!

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