Google 并不正式支持在 Mac 上编译 Android。 但我读到这是可能的。
命令
m
有错误
如何修复该错误?
错误:
"Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\" \"11.0\" \"11.1\"]"
我知道问题是由于 sdk 不兼容造成的,在指南中我看到你需要从 https://github.com/phracker/MacOSX-SDKs/releases 下载兼容的 sdk,但我不能找一个适用于 mac 13.3 的
更新: 我将我的 sdk 编号添加到数组中, 正如帖子中的https://stackoverflow.com/a/53715111/9458132。 现在出现错误:
'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
我尝试在代码中修复它(虽然当然这不是推荐的事情...),无论如何都会出现错误:
`ld: in /Volumes/aosp/source/prebuilts/rust/darwin-x86/1.51.0/lib/rustlib/x86_64-apple-darwin/lib/libunwind-6c9932b2c088cadd.rlib(lib.rmeta), archive member 'lib. rmeta' with length 30728 is not mach-o or llvm bitcode file '/Volumes/aosp/source/prebuilts/rust/darwin-x86/1.51.0/lib/rustlib/x86_64-apple-darwin/lib/libunwind-6c9932b2c088cadd. rlib'
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
error: aborting due to previous error
15:15:09 ninja failed with: exit status 1
我正在使用 mac 13.3 (ventura)
SDK版本:
13.3
铿锵版本:
16.0.1
谢谢。
好吧,所以我正在尝试类似的方法,这个答案的解决方案实际上是将您当前的macOS SDK添加到
darwinSupportedSdkVersions
中的cc/config/x86_darwin_host.go
,就像这里,https://github.com/rajatgupta1998/build_soong/commit/845c27d520c601b71565d7754c6e2efb541414f4 .
您可以通过以下命令找到系统上安装的 sdk 的确切版本号:
find /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs -iname "*.sdk"
另一个答案也解释了这一点: https://stackoverflow.com/a/53715111/9458132
更新:对于
sprintf
弃用问题,您实际上可以通过相应地替换为 snprintf
来修复它,因为在 Xcode 14+ 上,sprintf 在 mac 上已弃用。有一些存储库需要此修补程序。
您可以通过将这些行添加到文件 x86_darwin_host.go 中来绕过 sprintf 错误(路径:build/soong/cc/config)
“-Wno-已弃用的声明”, “-Wno-不兼容的指针类型”, 在文件的 darwinCFlags 部分