Catalina编译android 10报错

环境

先声明一下环境:

系统: macOS Catalina 10.15.3

aosp分支版本:android-10.0.0_r21

编译目标版本:aosp_walleye-userdebug

当执行完编译相关命令后,最终执行make -j16的时候,出现了异常:

编译相关命令简介:

source build/envsetup.shlunch 21make -j16

异常一:系统不兼容

为了方便大家遇到的时候能搜到这里,我把整个异常的代码都贴出来:

Superli-2:aosp superli$ make -j16============================================PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=10TARGET_PRODUCT=aosp_walleyeTARGET_BUILD_VARIANT=userdebugTARGET_BUILD_TYPE=releaseTARGET_ARCH=arm64TARGET_ARCH_VARIANT=armv8-aTARGET_CPU_VARIANT=cortex-a73TARGET_2ND_ARCH=armTARGET_2ND_ARCH_VARIANT=armv8-aTARGET_2ND_CPU_VARIANT=cortex-a73HOST_ARCH=x86_64HOST_OS=darwinHOST_OS_EXTRA=Darwin-19.3.0-x86_64-10.15.3HOST_BUILD_TYPE=releaseBUILD_ID=QQ1A.200105.002OUT_DIR=outPRODUCT_SOONG_NAMESPACES=device/google/wahoo vendor/google/camera hardware/google/pixel============================================[  0% 2/22868] build out/target/product/walleye/obj/ETC/sepolicy_tests_intermedsepolicy_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_2FAILED: 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_2FAILED: 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 无法识别设备

执行 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地址。

找不到ROM位置

以上各种都解决完后,执行fastboot -w flashall刷机,出现找不到ROM位置的异常:

Superli-2:walleye superli$ fastboot -w flashallerror: neither -p product specified nor ANDROID_PRODUCT_OUT setSuperli-2:walleye superli$ 

或者说这种异常:

error: could not load android-info.txt

网上各种说法,都是让你去配置ANDROID_PRODUCT_OUT或者指定-p参数,但是并没有用。 如果你和我遇到的差不多,那可能是你当前的shell会话,没有执行环境初始化。

解决:我因为编译完后,中途退出了shell,重新打开准备刷系统,结果报了这个错。 只要重新初始化一下编译环境就可以解决:

source build/envsetup.shlunch 21

执行完后,再去对应目录刷系统,就可以成功了。``

差不多就这些了,Enjoy~

更多相关文章

  1. Nginx系列教程(六)| 手把手教你搭建 LNMP 架构并部署天空网络电影
  2. Android(安卓)rom开发:webview崩溃问题Binary XML file line #103
  3. Android模拟器无法上网问题
  4. 浅入浅出Android(014):HTTP GET获取文本内容
  5. Android自定义系统分享面板
  6. Android(安卓)so 文件全部报错:Duplicate resources
  7. android中的hdpi,ldpi,mdpi
  8. Ubuntu下搭建Android开发平台
  9. Android(安卓)NDK 调试

随机推荐

  1. sql语句返回主键SCOPE_IDENTITY()
  2. uniqueidentifier转换成varchar数据类型
  3. sql 存储过程分页代码 支持亿万庞大数据
  4. 简单触发器的使用 献给SQL初学者
  5. sqlserver获取当前日期的最大时间值
  6. sqlserver中获取月份的天数的方法分享
  7. sqlserver中如何查询出连续日期记录的代
  8. SQLserver 数据库危险存储过程删除与恢复
  9. mssql中获取指定日期所在月份的第一天的
  10. SQL集合函数中case when then 使用技巧