先声明一下环境:
系统: macOS Catalina 10.15.3
aosp分支版本:android-10.0.0_r21
编译目标版本:aosp_walleye-userdebug
当执行完编译相关命令后,最终执行make -j16
的时候,出现了异常:
编译相关命令简介:
source build/envsetup.sh lunch 21 make -j16
为了方便大家遇到的时候能搜到这里,我把整个异常的代码都贴出来:
Superli-2:aosp superli$ make -j16
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=10
TARGET_PRODUCT=aosp_walleye
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=cortex-a73
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=cortex-a73
HOST_ARCH=x86_64
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-19.3.0-x86_64-10.15.3
HOST_BUILD_TYPE=release
BUILD_ID=QQ1A.200105.002
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/google/wahoo vendor/google/camera hardware/google/pixel
============================================
[ 0% 2/22868] build out/target/product/walleye/obj/ETC/sepolicy_tests_intermed
sepolicy_testsFAILED: out/target/product/walleye/obj/ETC/sepolicy_tests_intermediates/
/bin/bash -c "(out/host/darwin-x86/bin/sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/walleye/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/walleye/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -p out/target/product/walleye/obj/ETC/sepolicy_intermediates/sepolicy ) && (touch out/target/product/walleye/obj/ETC/sepolicy_tests_intermediates/sepolicy_tests )"
/bin/bash: line 1: 47188 Segmentation fault: 11 ( out/host/darwin-x86/bin/sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/walleye/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/walleye/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -p out/target/product/walleye/obj/ETC/sepolicy_intermediates/sepolicy )
[ 0% 3/22868] build out/target/product/walleye/obj/ETC/treble_sepolicy_tests_2
FAILED: out/target/product/walleye/obj/ETC/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0
/bin/bash -c "(out/host/darwin-x86/bin/treble_sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/walleye/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/walleye/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -b out/target/product/walleye/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/walleye/obj/ETC/treble_sepolicy_tests_28.0_intermediates/28.0_mapping.combined.cil -o out/target/product/walleye/obj/ETC/treble_sepolicy_tests_28.0_intermediates/built_28.0_plat_sepolicy -p out/target/product/walleye/obj/ETC/sepolicy_intermediates/sepolicy -u out/target/product/walleye/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil ) && (touch out/target/product/walleye/obj/ETC/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0 )"
/bin/bash: line 1: 47187 Segmentation fault: 11 ( out/host/darwin-x86/bin/treble_sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/walleye/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/walleye/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -b out/target/product/walleye/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/walleye/obj/ETC/treble_sepolicy_tests_28.0_intermediates/28.0_mapping.combined.cil -o out/target/product/walleye/obj/ETC/treble_sepolicy_tests_28.0_intermediates/built_28.0_plat_sepolicy -p out/target/product/walleye/obj/ETC/sepolicy_intermediates/sepolicy -u out/target/product/walleye/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil )
[ 0% 4/22868] build out/target/product/walleye/obj/ETC/treble_sepolicy_tests_2
FAILED: out/target/product/walleye/obj/ETC/treble_sepolicy_tests_27.0_intermediates/treble_sepolicy_tests_27.0
/bin/bash -c "(out/host/darwin-x86/bin/treble_sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/walleye/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/walleye/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -b out/target/product/walleye/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/walleye/obj/ETC/treble_sepolicy_tests_27.0_intermediates/27.0_mapping.combined.cil -o out/target/product/walleye/obj/ETC/treble_sepolicy_tests_27.0_intermediates/built_27.0_plat_sepolicy -p out/target/product/walleye/obj/ETC/sepolicy_intermediates/sepolicy -u out/target/product/walleye/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil ) && (touch out/target/product/walleye/obj/ETC/treble_sepolicy_tests_27.0_intermediates/treble_sepolicy_tests_27.0 )"
/bin/bash: line 1: 47190 Segmentation fault: 11 ( out/host/darwin-x86/bin/treble_sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/walleye/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/walleye/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -b out/target/product/walleye/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/walleye/obj/ETC/treble_sepolicy_tests_27.0_intermediates/27.0_mapping.combined.cil -o out/target/product/walleye/obj/ETC/treble_sepolicy_tests_27.0_intermediates/built_27.0_plat_sepolicy -p out/target/product/walleye/obj/ETC/sepolicy_intermediates/sepolicy -u out/target/product/walleye/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil )
17:56:43 ninja failed with: exit status 1
#### failed to build some targets (21 seconds) ####
该问题是因为编译脚本中的内容和Catalina系统不兼容,google已经出了官方补丁,补丁地址。
要解决的同学,可以点进去看看,不过作为一个唯饭博客,我会直接告诉你怎么做。
用工具打开你的/system/sepolicy/Android.bp
这个文件,打开后长这样:
// libsepolwrap gets loaded from the system python, which does not have the
// ASAN runtime. So turn off sanitization for ourself, and use static
// libraries, since the shared libraries will use ASAN.
static_libs: [
"libbase",
"libsepol",
],
stl: "libc++_static",
sanitize: {
never: true,
},
}
将stl: "libc++_static",
删除并保存即可。
然后再重新执行编译就行了。
保险起见,你可以把另一个补丁也加上,补丁地址。
用工具打开/build/soong/cc/config/x86_darwin_host.go
,打开后长这样:
darwinSupportedSdkVersions = []string{
"10.10",
"10.11",
"10.12",
"10.13",
"10.14",
}
将它改为:
darwinSupportedSdkVersions = []string{
"10.10",
"10.11",
"10.12",
"10.13",
"10.14",
"10.15",
}
我用过这两个文件的修改后,编译一次成功。但愿你也是这样。
执行 fastboot -w flashall
或者fastboot devices
的时候,出现如下异常:
ERROR: Couldn't create a device interface iterator: (e00002bd)
ERROR: Couldn't create a device interface iterator: (e00002bd)
ERROR: Couldn't create a device interface iterator: (e00002bd)
原因也是fastboot 版本不兼容。
解决 我将fastboot 版本替换为 26就可以了,如何更换? 去这个地址:platform-tools_r26.0.1, 下载解压后,将一个名为fastboot
的可执行文件替换到你当前的fastboot
目录即可。
你可以通过
which fastboot
看到你当前的fastboot
地址。
以上各种都解决完后,执行fastboot -w flashall
刷机,出现找不到ROM位置的异常:
Superli-2:walleye superli$ fastboot -w flashall
error: neither -p product specified nor ANDROID_PRODUCT_OUT set
Superli-2:walleye superli$
或者说这种异常:
error: could not load android-info.txt
网上各种说法,都是让你去配置ANDROID_PRODUCT_OUT
或者指定-p
参数,但是并没有用。 如果你和我遇到的差不多,那可能是你当前的shell会话,没有执行环境初始化。
解决:我因为编译完后,中途退出了shell,重新打开准备刷系统,结果报了这个错。 只要重新初始化一下编译环境就可以解决:
source build/envsetup.sh
lunch 21
执行完后,再去对应目录刷系统,就可以成功了。``
差不多就这些了,Enjoy~