macos 环境 aosp android 源码常见编译错误

1,636 阅读1分钟

Could not find a supported mac sdk: ["10.10" "10.11" "10.12" "10.13" "10.14"]

# What mac sdk do you have installed?

find /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs -iname "*.sdk"

# edit the configuration file

subl //build/soong/cc/config/x86_darwin_host.go

# add your version to the listed versions in the file

darwinSupportedSdkVersions = []string{

​ "10.10",

​ "10.11",

​ "10.12",

​ "10.14", <--- add your version that you turned up in the find command here

}

stackoverflow.com/questions/5…

scripts/mod/mk_elfconfig.c fatal error: 'elf.h' file not found

sudo cp -a external/elfutils/libelf/elf.h /usr/local/include

iluhcm.com/2015/08/20/…

这个问题是由于os x的系统include路径里面少了一个elf.h这个文件,到 http://www.rockbox.org/tracker/9006?getfile=16683 这个地方,把里面的内容保存成elf.h,放到内核源码的kernel/**scripts/mod/**下面即可。

stackoverflow.com/questions/1…

elf.h fatal error: 'features.h' file not found

/usr/local/include/elf.h 文件中去掉 features.h 的引用 include 行

external/python/cpython2/Modules/getpath.c:414:50: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint32_t *' (aka 'unsigned int *') [-Werror,-Wincompatible-pointer-types]

else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP)

^~~~~~~~~~~~~

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/mach-o/dyld.h:98:54: note: passing argument to parameter 'bufsize' here

extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);

修改external/python/cpython2/Modules/getpath.c 中的对应传参变量为 uint32_t 类型

/bin/bash: line 1: 18471 Segmentation fault: 11 ( out/host/darwin-x86/bin/sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/generic_x86_64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/generic_x86_64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -p out/target/product/generic_x86_64/obj/ETC/sepolicy_intermediates/sepolicy )

Solution:

make SELINUX_IGNORE_NEVERALLOWS=true

stackoverflow.com/questions/5…

fatal error: 'openssl/bio.h' file not found

brew install openssl 
brew link openssl --force

stackoverflow.com/questions/3…