【发布时间】:2015-01-06 22:09:03
【问题描述】:
所以我必须将一些 YML 文件导入到我最新的 swift 项目中,我发现这个可爱的库 (https://github.com/behrang/yaml.swift) 似乎工作得很好。问题是,它是一个 iOS 项目,默认情况下 yaml.swift 为 OSX 编译。
没什么大不了的,我在makefile中更改了这一行
sdk = $$(xcrun --show-sdk-path --sdk macosx)
到这里
sdk = $$(xcrun --show-sdk-path --sdk iphoneos)
一旦我进行此切换,我就会在编译时遇到各种错误。
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/mach/ndr.h:37:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/mach/ndr.h:37:
#include <libkern/OSByteOrder.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/libkern/OSByteOrder.h:45:10: error: 'libkern/machine/OSByteOrder.h' file not found
#include <libkern/machine/OSByteOrder.h>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/shims/shims.h:13:10: error: could not build module 'Darwin'
#include <stddef.h> // for size_t
^
<unknown>:0: error: could not build Objective-C module 'SwiftShims'
make: *** [build/libyaml.dylib] Error 1
这是最后几行,但这要追溯到几千行。我找不到的任何东西似乎都与我要编译的库有关。似乎这似乎是 SDK 的问题。我已经尝试挖掘并查看该库是否依赖于 OSX 框架,但它唯一导入的是 Foundation。
有什么想法可能与错误有关吗?
到目前为止,我想出的是,SwiftShims 是一个 swift 模块(不是错误所说的 Objective-C)。在 SwiftShims.swift 文件的顶部,它似乎正在导入一些 Darwin/C 模块。也许这就是问题所在?但是 SwiftShims 没有被导入到这个模块的任何 swift 文件中。我真的迷路了,如果能得到任何帮助,我将不胜感激!
【问题讨论】:
-
您是否尝试过使用
iphonesimulator作为SDK?可能是您没有完整的 iOS SDK。