【发布时间】:2017-07-25 04:12:50
【问题描述】:
我有一个 objc_library 规则告诉我它找不到任何 SDK 框架头(这个问题不是 IOKit 特有的,我根本找不到任何框架)。
#import <IOKit/IOKitLib.h>
致命错误:找不到“IOKit/IOKitLib.h”文件
我的 sdk_frameworks 中已经有了“IOKit”。如果我查看 /System/Library/Frameworks/IOKit.framework,我会发现没有包含此文件的目录 Headers。如果这就是 Bazel 正在寻找的地方,也许就不足为奇了。
如果我再仔细看看,我会发现更多 SDK 的结果。
$ find /Applications/Xcode.app/ -name IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/System/Library/Frameworks/IOKit.framework
我认为这是我想要的,因为我正在为 MacOSX 开发。
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/IOKit.framework
我可以告诉 Bazel 使用那个 SDK 吗?我应该这样做吗?我怎样才能知道 Bazel 在哪里寻找这些东西?我对使用 Bazel 非常熟悉,但是当最基本的事情失败时,我真的不确定如何调试。
这是最简单的失败示例。
构建:
objc_library(
name = "test",
srcs = ["test.cpp"],
copts = ["-ObjC++"],
sdk_frameworks = ["IOKit"],
)
// test.cpp
#import <IOKit/IOKitLib.h>
我在 bazel-discuss 上发布了这个,但它并没有引起太大的关注。我正在使用 Bazel 0.5.2。 https://groups.google.com/forum/#!topic/bazel-discuss/HhAjKblwHwk
【问题讨论】:
标签: objective-c macos bazel