Apple Mach-O 链接器 (id) 警告:为 MacOSX 构建,但链接到为 iOS 构建的 dylib
从过去 xCode 4 抱怨链接器问题的某个时刻开始:
ld:警告:为 MacOSX 构建,但链接到为 dylib 构建的 iOS: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks//CoreGraphics.framework/CoreGraphics
我已经检查了所有内容,但配置中仍然没有任何可疑之处,并且它编译并运行。 我唯一看到的是 CoreGraphics.framework 之前的双斜杠,为什么我不知道。尝试删除并再次添加“构建阶段”上的库,但没有帮助。
Starting from some point in the past xCode 4 in complaining about linker problems:
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
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有时,通过查看其所使用的命令行的构建日志来调试 Xcode 问题会更容易。
如果您从命令行构建,并且不指定-miphoneos-version-min=,则可以收到该消息
Sometimes it's easier to debug Xcode problems by looking at the build log for the command lines it's using.
If you're building from the command line, you can get that message if you don't specify -miphoneos-version-min=
检查您的主要目标和测试目标的框架搜索路径。
我的心里有很多废话。
有用 XCode 4 编写的旧项目,刚刚开始在 XCode 5 中使用单元测试。
这是我必须让我的测试项目运行的最低限度
注意:如果将框架拖到 XCode 中。 XCode 5 有对路径进行硬编码的坏习惯
,因此
如果您移动项目可能会出现问题
检查正确性的最佳方法是创建一个可以正常运行测试的新单视图项目。
Check your Framework Search Paths for your Main target and your test Target.
I had a lot of crap in mine.
had old project written in XCode 4 and just started to use Unit Tests in XCode 5.
Here's the minimum I have to get my test project to run
Note: If you drag a framework into XCode. XCode 5 has bad habit of hardcoding the path
should be
so if you moved your project might get problems
Best way to check whats correct is to create a new single view project that runs tests ok.
如果您使用 Carthage 并编译 Mac 应用程序,请搜索项目的
框架搜索路径
,您可能会找到类似$(PROJECT_DIR)/Carthage/Build/iOS
的内容。删除它解决了我的问题。
If you're using Carthage and compiling a Mac app, search on your project's
Framework Search Paths
you might find something like$(PROJECT_DIR)/Carthage/Build/iOS
.Removing that fixed my issue.
此问题是由于 Xcode 中包含错误的框架版本造成的。该项目是为 Mac OS X 构建的,但它使用 iOS 版本的框架。
This issue is due to include a wrong framework version in Xcode. The project is built for Mac OS X, but it uses iOS version's framework.