前置条件
- macOS Sonoma (14.2.1) 强烈建议至少是这个版本的系统,更早的系统存在虚拟机稳定性问题 ( Fatal Error Encountered: Rosetta 2 Emulation with Java VM Inside Container #7068 )
- MacBook Pro 2023-Apple M2 Pro (4能效核、8性能核、32GB内存、2TB磁盘)
- Homebrew (4.0.28 或更高版本)
- UTM 4.4.5
- ubuntu 22.04.3 Server ARM
根据 Google 官方文档,2021年6月22日之后的Android系统版本不支持在macOS系统上构建,我们在 Applic Silicon 的 macOS 系统是不能直接成功构建后续版本的,但是之前的版本可以在修改编译配置后成功编译,只是是否能正常运行存疑。
尝试过使用 Podman Desktop / Docker 方式进行编译、也尝试过借助 OrbStack, Lima 这些纯虚拟机通过安装 ubuntu 22.04 系统镜像的方式进行编译,结果都在执行 lunch 命令的时候长时间卡住,观察系统进程发现名为 nsjail 进程的 CPU 占用持续卡住在 100% 上无法继续编译,并且由于 Docker 或者虚拟机文件系统是 Linux 文件系统,而宿主机的文件系统是 AppleFS 文件系统,导致需要进行文件转换,中间的转换性能代价非常高,性能很差。
相反,目前测试来看,直接在 UTM 虚拟机里执行编译的性能反倒更好一些。
目前测试发现存在严重的文件系统缺陷,编译/大量文件复制过程中,经常出现文件系统损坏,导致编译失败。
原因参考:
https://github.com/utmapp/UTM/pull/5869
https://github.com/utmapp/UTM/pull/5919
需要等待 UTM 合并到主分支。
另外,我们需要安装 Rosetta 2 支持运行部分 x86_64 应用。注意 Rosetta 2 只支持 64 位应用,不支持 32 位应用。 参考 Does Rosetta 2 support 32-bit Intel apps?
准备环境
安装依赖
1 2 |
# 安装 Rosetta 2 支持 x86_64 应用 $ /usr/sbin/softwareupdate --install-rosetta --agree-to-license |
安装虚拟机应用
安装ARM版本操作系统
去 Ubuntu Server for ARM 官网,下载 Ubuntu 22.04.3 LTS ARM 系统镜像。
创建虚拟机
虚拟化引擎选择部分,务必勾选 Apple Virtualization 。如果不勾选此项,那么后续的 Rosetta 是没办法选择的,并且性能是不足以进行系统编译的。
如下图:
内存,CPU 部分,建议尽量多给一些,这样编译速度更快,但是不一太多,太多会导致宿主机卡顿,这个需要均衡考虑,尤其是宿主机还需要同步执行其他事情的时候。
如下图:
磁盘部分,建议至少 400GB 以上,如下图:
共享目录部分,如果是编译代码,不建议使用,性能不够,如果是常规的文件共享,问题不大。
如下图:
最终的配置如下:
操作系统安装
键盘点击确认(回车),默认下一步
键盘点击确认(回车),默认下一步
键盘点击确认(回车),默认下一步
键盘点击确认(回车),默认下一步
键盘点击确认(回车),默认下一步
键盘点击确认(回车),默认下一步
等待镜像服务器测试完成之后,键盘点击确认(回车),默认下一步
接下来, 注意:务必取消掉 “Set up this disk as an LVM group”选项,否则不管你给出磁盘有多大,都是默认分配 100GB 的磁盘,其余磁盘空间需要手工分区。
移动上下键,到指定位置,点击键盘上的空格,取消选中,如下图:
移动上下键,到 Done ,键盘点击确认(回车),默认下一步
键盘点击确认(回车),默认下一步
移动上下键,到 Continue ,确认使用上述的分区配置,键盘点击确认(回车),执行下一步
用户名,密码,机器名等配置(此处,我们默认都输入 ubuntu),输入完成后,移动上下键,键盘点击确认(回车),执行下一步
键盘点击确认(回车),默认下一步
配合上下键,空格,选中 "Install OpenSSH server", 键盘点击确认(回车),默认下一步
此处,没有我们需要的服务器配置,键盘上下键调整到 “Done” 高亮 ,点击确认(回车),默认下一步
等待安装完成,直到底部出现 “Reboot Now”,键盘上下键调整到 “Reboot Now” 高亮 ,点击确认(回车)系统重启,安装完成。
重启之后,会再次回到安装界面,如下图:
原因是我们没有弹出安装镜像导致的,我们需要手工弹出安装光盘,直接关闭虚拟机,然后如下操作
设置 Rosetta 启用对于 x86_64 架构应用的支持
登录到刚刚创建的虚拟机(建议通过 SSH 登录进去,直接通过虚拟机提供的屏幕操作,不方便复制粘贴),然后执行如下命令:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ sudo mkdir /media/rosetta $ sudo mount -t virtiofs rosetta /media/rosetta $ sudo apt install binfmt-support # 此命令的是通知操作系统 0x7f 开头的ELF文件委托给 rosetta 进行加载 # 0x7f 开头代表的是 x86_64 的可执行文件, rosetta 会把文件进行动态转译成 ARM64 指令,从而提升执行性能 # 另外注意,rosetta 只支持 x86_64 , 不支持 x86_32 的应用 $ sudo /usr/sbin/update-binfmts --install rosetta /media/rosetta/rosetta \ --magic "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00" \ --mask "\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" \ --credentials yes --preserve no --fix-binary yes |
添加到系统文件加载项,要求系统启动的时候自动加载 rosetta 。
1 2 3 |
$ sudo apt install vim $ sudo vim /etc/fstab |
在文件尾部新增一行:
1 |
rosetta /media/rosetta virtiofs ro,nofail 0 0 |
修改后的配置文件类似如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/vda2 during curtin installation /dev/disk/by-uuid/c564e919-be8a-40fc-89cf-bba11fbc6c45 / ext4 defaults 0 1 # /boot/efi was on /dev/vda1 during curtin installation /dev/disk/by-uuid/92AB-2A45 /boot/efi vfat defaults 0 1 /swap.img none swap sw 0 0 rosetta /media/rosetta virtiofs ro,nofail 0 0 |
执行 df 命令,应该可以看到 rosetta 已经被正常加载,如下:
1 2 3 4 5 6 7 8 9 |
$ df -h Filesystem Size Used Avail Use% Mounted on tmpfs 2.6G 1012K 2.6G 1% /run /dev/vda2 392G 11G 361G 3% / tmpfs 13G 0 13G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/vda1 1.1G 6.4M 1.1G 1% /boot/efi tmpfs 2.6G 4.0K 2.6G 1% /run/user/1000 rosetta 1.9T 1.8T 25G 99% /media/rosetta |
配置完成之后,务必重启一次虚拟机,否则大概率虚拟机系统会在运行过程中崩溃。
启用多处理器架构应用安装
1 |
$ sudo dpkg --add-architecture amd64 |
此时注意,默认情况下 ARM 安装包的 APT 服务器是跟 x86 安装包的服务器是不同的,如果执行上述命令后,更新安装源,会报错找不到文件,我们需要手工指定不同架构的安装包搜索服务器。可以参照下面的方式修改 /etc/apt/sources.list 显式声明各个架构的服务器地址,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy universe deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy universe deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates universe deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy multiverse deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy multiverse deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates multiverse deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security universe deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security universe deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security multiverse deb-src [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security multiverse deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy main restricted deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy universe deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates universe deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy multiverse deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse deb [arch=amd64] http://security.ubuntu.com/ubuntu jammy-security main restricted deb [arch=amd64] http://security.ubuntu.com/ubuntu jammy-security universe deb [arch=amd64] http://security.ubuntu.com/ubuntu jammy-security multiverse |
更新源
1 2 3 4 5 |
$ sudo apt update $ sudo apt dist-upgrade $ sudo apt autoremove |
至此,我们已经可以在 ARM64 环境下,正常安装并运行 x86_64 的应用,只是安装应用的时候,需要明确指定安装包的处理器架构。
安装编译依赖
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 此处需要明确架构为 x86_64 架构,否则默认安装 ARM 架构的应用,我们编译需要使用 x86_64 架构的编译工具 $ sudo apt install gcc:amd64 # 解决 # prebuilts/clang/host/linux-x86/clang-3289846/bin/clang.real: error while loadin g shared libraries: libncurses.so.5: cannot open shared object file: No such fi le or directory $ sudo apt install libncurses5:amd64 # repo、git、ccache 这些工具,使用ARM64版本即可 $ sudo apt install repo ccache zip unzip $ sudo apt install git $ git config --global user.email "user@email.com" $ git config --global user.name "user" $ sudo apt autoremove |
代码拉取&构建
1. 使用镜像下载Android
源代码
清华大学的镜像
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 建议直接下载压缩包,使用repo更新基本上都会失败,即使用国内镜像也是一样(目前大约96GB) # 不建议直接在aosp根目录下直接操作,由于APFS创建的卷宗根目录下会放置回收站 .Trashes 因此编译的时候可能会报错: # opendir failed: .Trashes: Operation not permitted # 建议通过直接清华源的镜像压缩包进行代码同步 # 不要通过 repo sync 进行,目前测试发现 repo sync 成功的概率越来越低了 # 此处大概率虚拟机会挂掉,原因在UTM官方有解释 https://docs.getutm.app/guides/debian/ # There is a bug present in Linux virtual machines on Ventura and the base M1 chip which causes the virtual machine to kernel panic and freeze up randomly. Unfortunately, this means that base M1 users should avoid Apple Virtualization backend until Apple or Linux maintainers provide a fix. # 如果报错磁盘损坏,这个是由于macOS虚拟机的BUG, # 参考 # https://github.com/utmapp/UTM/pull/5869 # https://github.com/utmapp/UTM/pull/5919 # 等待UTM合并到主分支 $ curl -OC - https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar $ tar xvf aosp-latest.tar $ cd aosp |
2.检出需要编译的分支
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# 查看分支 # cd .repo/manifests # git branch -a | grep "android-12" # 国内使用清华的镜像替换访问链接 参考 https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/ # git config --global url.https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/.insteadof https://android.googlesource.com # 检出代码代码 # repo init -b android-10.0.0_r47 # repo init -b android-security-11.0.0_r72 $ repo init -b android-12.1.0_r26 $ repo sync -j4 --fail-fast |
3.准备编译环境
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
$ export USE_CCACHE=1 # 移除 nsjail 否则无法启动编译 $ mv prebuilts/build-tools/linux-x86/bin/nsjail prebuilts/build-tools/linux-x86/bin/nsjail.old # 执行构建 $ source build/envsetup.sh # 默认编译的镜像是 release 模式的,运行速度更快,但是不方便系统调试 # 如果需要跟踪调试代码,建议编译为调试类型 # export TARGET_BUILD_TYPE=debug # 纯ARM64系统镜像,可以刷机 # lunch aosp_arm64-eng # eng:代表 engineer,开发工程师的版本,拥有最大的权限(root等),具有额外调试工具的开发配置。 # 执行 lunch 命令可以输出全部的编译目标列表 # 更多的编译选项可以从 build/make/target/product/ 下看到 # 模拟器使用的系统镜像 # lunch sdk_phone_arm64-userdebug $ lunch sdk_phone_arm64-eng # 禁止 DEX 文件编译期预先代码转换 # 这个优化的目的是提高系统第一次启动速度,这个优化选项目前一定会编译失败 # Android 12 配置文件在 build/core/dex_preopt_config.mk # 但是修改需要在编译目标的 BoardConfig.mk 尾部增加, # 环境变量里面配置 'export WITH_DEXPREOPT=false' 无效 $ sed -i '$a\WITH_DEXPREOPT := false' build/target/board/emulator_arm64/BoardConfig.mk |
4.编译
1 |
$ m |
注意,如果执行
1 |
lunch sdk_phone_arm64-eng |
的时候长时间卡住,Ctrl + C 停止之后报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
ubuntu@ubuntu:~/aosp$ lunch sdk_phone_arm64-eng 06:19:01 Got signal: interrupt 06:19:01 Got signal: interrupt 06:19:01 Still alive, killing subprocesses... 06:19:02 Got signal: interrupt 06:19:02 Still alive, cleaning up... 06:19:02 Timed out exiting... panic: write to panicWriter goroutine 281325 [running]: android/soong/ui/logger.panicWriter.Write(...) build/soong/ui/logger/logger.go:185 log.(*Logger).Output(0xc0001660a0, 0x3, 0xc000c74e80, 0x15, 0x0, 0x0) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/log/log.go:172 +0x287 android/soong/ui/logger.(*stdLogger).Output(0xc000150210, 0x2, 0xc000c74e80, 0x15, 0x15, 0x7f1d68) build/soong/ui/logger/logger.go:223 +0x88 android/soong/ui/logger.(*stdLogger).Panicln(0xc000150210, 0xc00c028070, 0x1, 0x1) build/soong/ui/logger/logger.go:318 +0x78 android/soong/ui/build.handleSignals.func1.1(0x7f1d20, 0xc000150210, 0xc0001701e0) build/soong/ui/build/signal.go:71 +0xaa created by android/soong/ui/build.handleSignals.func1 build/soong/ui/build/signal.go:68 +0x105 goroutine 1 [chan receive]: os/exec.(*Cmd).Wait(0xc0057ce000, 0x0, 0x0) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/exec/exec.go:509 +0x125 os/exec.(*Cmd).Run(0xc0057ce000, 0xc007804000, 0x0) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/exec/exec.go:341 +0x5c os/exec.(*Cmd).CombinedOutput(0xc0057ce000, 0xc0068ca010, 0x1, 0x1, 0xe, 0xc0057ce000) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/exec/exec.go:561 +0x91 android/soong/ui/build.(*Cmd).sandboxSupported.func1() build/soong/ui/build/sandbox_linux.go:87 +0x3b4 sync.(*Once).doSlow(0x9fcac0, 0xc0002f1218) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/sync/once.go:66 +0xe3 sync.(*Once).Do(...) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/sync/once.go:57 android/soong/ui/build.(*Cmd).sandboxSupported(0xc009acd800, 0x0) build/soong/ui/build/sandbox_linux.go:69 +0x8e android/soong/ui/build.(*Cmd).prepare(0xc009acd800) build/soong/ui/build/exec.go:56 +0x3f android/soong/ui/build.(*Cmd).Start(0xc009acd800, 0x0, 0x0) build/soong/ui/build/exec.go:64 +0x2b android/soong/ui/build.(*Cmd).StartOrFatal(0xc009acd800) build/soong/ui/build/exec.go:88 +0x2f android/soong/ui/build.dumpMakeVars(0xc0000c4480, 0xc000188000, 0x0, 0x0, 0x0, 0xc0039a2f00, 0x2e, 0x2f, 0x0, 0x0, ...) build/soong/ui/build/dumpvars.go:108 +0x693 android/soong/ui/build.DumpMakeVars(0xc0000c4480, 0xc000188000, 0x0, 0x0, 0x0, 0xc0039a2c00, 0x2f, 0x30, 0x0, 0x0, ...) build/soong/ui/build/dumpvars.go:68 +0x708 main.dumpVars(0xc0000c4480, 0xc000188000, 0xc0000c4140, 0x4, 0x4, 0xc0000b1238, 0x3) build/soong/cmd/soong_ui/main.go:316 +0x5d9 main.main() build/soong/cmd/soong_ui/main.go:206 +0x12ab goroutine 35 [syscall]: os/signal.signal_recv(0x7e9f80) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/runtime/sigqueue.go:147 +0x9c os/signal.loop() /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/signal/signal_unix.go:23 +0x22 created by os/signal.init.0 /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/signal/signal_unix.go:29 +0x41 goroutine 37 [select]: android/soong/ui/build.handleSignals(0xc00009a180, 0x7f1d20, 0xc000150210, 0xc000152050, 0xc0001701e0) build/soong/ui/build/signal.go:79 +0x136 created by android/soong/ui/build.SetupSignals build/soong/ui/build/signal.go:44 +0x136 goroutine 281322 [IO wait, 4 minutes]: internal/poll.runtime_pollWait(0x7ffffc2dcea8, 0x72, 0xffffffffffffffff) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/runtime/netpoll.go:184 +0x55 internal/poll.(*pollDesc).wait(0xc0005b2078, 0x72, 0x201, 0x216, 0xffffffffffffffff) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/internal/poll/fd_poll_runtime.go:87 +0x45 internal/poll.(*pollDesc).waitRead(...) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Read(0xc0005b2060, 0xc00001a9ea, 0x216, 0x216, 0x0, 0x0, 0x0) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/internal/poll/fd_unix.go:169 +0x1cf os.(*File).read(...) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/file_unix.go:259 os.(*File).Read(0xc0068c8008, 0xc00001a9ea, 0x216, 0x216, 0x3d, 0x0, 0x0) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/file.go:116 +0x71 bytes.(*Buffer).ReadFrom(0xc007804000, 0x7e77c0, 0xc0068c8008, 0x7ffffc258028, 0xc007804000, 0x78f801) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/bytes/buffer.go:204 +0xb4 io.copyBuffer(0x7e7420, 0xc007804000, 0x7e77c0, 0xc0068c8008, 0x0, 0x0, 0x0, 0x4562d0, 0xc006175fa0, 0x406885) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/io/io.go:388 +0x2ed io.Copy(...) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/io/io.go:364 os/exec.(*Cmd).writerDescriptor.func1(0xc006175fc0, 0x5d3fd5) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/exec/exec.go:311 +0x63 os/exec.(*Cmd).Start.func1(0xc0057ce000, 0xc0073b4080) /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/exec/exec.go:435 +0x27 created by os/exec.(*Cmd).Start /home/ubuntu/aosp/prebuilts/go/linux-x86/src/os/exec/exec.go:434 +0x608 |
则观察当前执行的进程,会发现名为 nsjail 的进程长时间卡住,并且 100% CPU 占用,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
ubuntu@ubuntu:~/aosp$ top top - 06:19:16 up 3:16, 2 users, load average: 1.02, 1.00, 0.90 Tasks: 175 total, 2 running, 173 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.6 us, 7.8 sy, 0.0 ni, 91.6 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 26003.1 total, 2185.0 free, 491.4 used, 23326.8 buff/cache MiB Swap: 8192.0 total, 8185.2 free, 6.8 used. 25160.6 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 38314 ubuntu 20 0 1198852 3496 1116 R 100.0 0.0 4:30.61 nsjail 93 root 20 0 0 0 0 I 0.3 0.0 0:01.22 kworker/7:1-eve+ 1 root 20 0 19028 9232 6024 S 0.0 0.0 0:01.96 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.04 kthreadd 3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp 4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp 5 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 slub_flushwq 6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns 8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H-ev+ 10 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq |
nsjail 是 Android 用于建立隔离环境,防止进程之间相互干扰的一个沙箱工具,功能类似 Docker 。
应用位于源代码的位置: prebuilts/build-tools/linux-x86/bin/nsjail
Rosetta 转译造成应用运行异常,最简单的方案,就是直接重命名或者删除 prebuilts/build-tools/linux-x86/bin/nsjail,让编译工具找不到 nsjail, 不使用沙箱进行编译即可。
如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
ubuntu@ubuntu:~/aosp$ mv prebuilts/build-tools/linux-x86/bin/nsjail prebuilts/build-tools/linux-x86/bin/nsjail.old ubuntu@ubuntu:~/aosp$ lunch sdk_phone_arm64-eng 06:58:21 Build sandboxing disabled due to nsjail error. ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=11 TARGET_PRODUCT=sdk_phone_arm64 TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_ARCH=arm64 TARGET_ARCH_VARIANT=armv8-a TARGET_CPU_VARIANT=generic TARGET_2ND_ARCH=arm TARGET_2ND_ARCH_VARIANT=armv8-a TARGET_2ND_CPU_VARIANT=generic HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-5.15.0-86-generic-x86_64-Ubuntu-22.04.3-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=RSV1.210329.100 OUT_DIR=out PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl ============================================ |
针对警告 “Build sandboxing disabled due to nsjail error.” 可以直接无视。
如果报错:
1 2 3 4 |
info: A new version of repo is available warning: repo is not tracking a remote branch, so it will not receive updates repo reset: 错误:Entry 'README.md' not uptodate. Cannot merge. 致命错误:不能重置索引文件至版本 'v2.37^0'。 |
则说明当前的 repo 版本太低,需要更新到最新版本。
执行如下命令:
1 2 3 |
$ cd .repo/repo $ git pull |
如果报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
[ 99% 104065/104178] //frameworks/base/boot:platform-bootclasspath dexpreopt bo FAILED: out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-core-icu4j.art out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-core-icu4j.oat out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-core-icu4j.vdex out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-ext.art out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-ext.oat out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-ext.vdex out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-framework-graphics.art out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-framework-graphics.oat out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-framework-graphics.vdex out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.art out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.oat out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.vdex out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-ims-common.art out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-ims-common.oat out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-ims-common.vdex out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-telephony-common.art out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-telephony-common.oat out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-telephony-common.vdex out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-voip-common.art out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-voip-common.oat out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot-voip-common.vdex out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot.invocation out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-core-icu4j.oat out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-ext.oat out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-framework-graphics.oat out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-framework.oat out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-ims-common.oat out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-telephony-common.oat out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-voip-common.oat mkdir -p out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64 && rm -f out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/*.art out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/*.oat out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/*.invocation && rm -f out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/*.art out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/*.oat out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/*.invocation && ANDROID_LOG_TAGS="*:e" out/soong/host/linux-x86/bin/dex2oatd --avoid-storing-invocation --write-invocation-to=out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot.invocation --runtime-arg -Xms64m --runtime-arg -Xmx64m --compiler-filter=speed-profile --profile-file=out/soong/emulator_arm64/dex_bootjars/boot.prof --dirty-image-objects=frameworks/base/config/dirty-image-objects --runtime-arg -Xbootclasspath:out/soong/emulator_arm64/dex_artjars_input/core-oj.jar:out/soong/emulator_arm64/dex_artjars_input/core-libart.jar:out/soong/emulator_arm64/dex_artjars_input/okhttp.jar:out/soong/emulator_arm64/dex_artjars_input/bouncycastle.jar:out/soong/emulator_arm64/dex_artjars_input/apache-xml.jar:out/soong/emulator_arm64/dex_bootjars_input/framework.jar:out/soong/emulator_arm64/dex_bootjars_input/framework-graphics.jar:out/soong/emulator_arm64/dex_bootjars_input/ext.jar:out/soong/emulator_arm64/dex_bootjars_input/telephony-common.jar:out/soong/emulator_arm64/dex_bootjars_input/voip-common.jar:out/soong/emulator_arm64/dex_bootjars_input/ims-common.jar:out/soong/emulator_arm64/dex_bootjars_input/core-icu4j.jar --runtime-arg -Xbootclasspath-locations:/apex/com.android.art/javalib/core-oj.jar:/apex/com.android.art/javalib/core-libart.jar:/apex/com.android.art/javalib/okhttp.jar:/apex/com.android.art/javalib/bouncycastle.jar:/apex/com.android.art/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/framework-graphics.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/apex/com.android.i18n/javalib/core-icu4j.jar --boot-image=out/soong/emulator_arm64/dex_artjars/android/apex/art_boot_images/javalib/boot.art --dex-file=out/soong/emulator_arm64/dex_bootjars_input/framework.jar --dex-file=out/soong/emulator_arm64/dex_bootjars_input/framework-graphics.jar --dex-file=out/soong/emulator_arm64/dex_bootjars_input/ext.jar --dex-file=out/soong/emulator_arm64/dex_bootjars_input/telephony-common.jar --dex-file=out/soong/emulator_arm64/dex_bootjars_input/voip-common.jar --dex-file=out/soong/emulator_arm64/dex_bootjars_input/ims-common.jar --dex-file=out/soong/emulator_arm64/dex_bootjars_input/core-icu4j.jar --dex-location=/system/framework/framework.jar --dex-location=/system/framework/framework-graphics.jar --dex-location=/system/framework/ext.jar --dex-location=/system/framework/telephony-common.jar --dex-location=/system/framework/voip-common.jar --dex-location=/system/framework/ims-common.jar --dex-location=/apex/com.android.i18n/javalib/core-icu4j.jar --generate-debug-info --generate-build-id --image-format=lz4hc --oat-symbols=out/soong/emulator_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot.oat --strip --oat-file=out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot.oat --oat-location=out/soong/emulator_arm64/dex_bootjars/android/system/framework/boot.oat --image=out/soong/emulator_arm64/dex_bootjars/android/system/framework/arm64/boot.art --instruction-set=arm64 --android-root=out/empty --no-inline-from=core-oj.jar --force-determinism --abort-on-hard-verifier-error --instruction-set-variant=generic --instruction-set-features=default --generate-mini-debug-info || ( echo 'ERROR: Dex2oat failed to compile a boot image.It is likely that the boot classpath is inconsistent.Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors.' ; false ) # hash of input list: 437a3591c025c9fd1ac9ac2dc9b33e87ffc83eab7aad35377244f02905acbdf3 dex2oatd F 01-02 17:41:16 1388115 1388115 obj_ptr-inl.h:58] Check failed: ref <= 0xFFFFFFFFU (ref=140737328603136, 0xFFFFFFFFU=4294967295) Runtime aborting... All threads: DALVIK THREADS (8): "main" prio=5 tid=1 Runnable (still starting up) | group="" sCount=0 ucsCount=0 flags=0 obj=(nil) self=0x55555772f8f0 | sysTid=1388115 nice=0 cgrp=default sched=0/0 handle=0x7fffffc78740 | state=R schedstat=( 19185934169 13701852544 5496 ) utm=1866 stm=52 core=4 HZ=100 | stack=0x5554ff800000-0x5554ff802000 stackSize=8188KB | held mutexes= "abort lock" "mutator lock"(shared held) native: #00 pc 0000000000da5528 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (UnwindStackCurrent::UnwindFromContext(unsigned long, void*)+88) native: #01 pc 0000000000da02d8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+136) native: #02 pc 0000000000e4582c /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+396) native: #03 pc 0000000000e6e846 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::DumpCheckpoint::Run(art::Thread*)+582) native: __compressed_pair_elem native: external/libcxx/include/memory:2140 native: __compressed_pair<true, void> native: external/libcxx/include/memory:2234 native: basic_string<nullptr_t> native: external/libcxx/include/string:820 native: UnwindStackCurrent::UnwindFromContext(unsigned long, void*) native: system/unwinding/libbacktrace/UnwindStack.cpp:169 native: #04 pc 0000000000e67522 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+290) native: art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool) native: art/runtime/native_stack_dump.cc:335 (discriminator 2) native: #05 pc 0000000000e67100 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool)+368) native: #06 pc 0000000000d3964a /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+186) native: #07 pc 0000000000d23136 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::Runtime::Abort(char const*)+406) native: #08 pc 000000000169e08c /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+60) native: #09 pc 000000000169dd15 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (android::base::LogMessage::~LogMessage()+341) native: #10 pc 0000000000cac4fd /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::mirror::Object* art::gc::Heap::AllocObjectWithAllocator<true, false, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>, unsigned long, art::gc::AllocatorType, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&)+2637) native: #11 pc 0000000000caba5f /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::mirror::Object* art::gc::Heap::AllocLargeObject<true, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>*, unsigned long, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&)+143) native: #12 pc 0000000000caa1f0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::mirror::Object* art::gc::Heap::AllocObjectWithAllocator<true, true, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>, unsigned long, art::gc::AllocatorType, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&)+1536) native: #13 pc 0000000000c9a2e9 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)+265) native: #14 pc 0000000000a5a749 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::InternTable::InternStrong(int, char const*)+121) native: art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const native: art/runtime/thread.cc:2193 (discriminator 2) native: #15 pc 000000000075b6e1 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ClassLinker::DoResolveString(art::dex::StringIndex, art::Handle<art::mirror::DexCache>)+81) native: #16 pc 00000000004b055b /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ClassLinker::ResolveString(art::dex::StringIndex, art::Handle<art::mirror::DexCache>)+251) native: #17 pc 00000000004a28d6 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::CompilerDriver::ResolveConstStrings(std::__1::vector<art::DexFile const*, std::__1::allocator<art::DexFile const*> > const&, bool, art::TimingLogger*)+1846) native: art::DumpCheckpoint::Run(art::Thread*) native: art/runtime/thread_list.cc:213 (discriminator 2) native: art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*) native: art/runtime/thread_list.cc:374 native: art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool) native: art/runtime/thread_list.cc:257 native: #18 pc 00000000004a32d5 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::CompilerDriver::PreCompile(_jobject*, std::__1::vector<art::DexFile const*, std::__1::allocator<art::DexFile const*> > const&, art::TimingLogger*, art::HashSet<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, art::DefaultEmptyFn<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, art::DataHash, art::DefaultStringEquals, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, art::VerificationResults*)+629) native: #19 pc 000000000048a5a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::Dex2Oat::CompileDexFiles(std::__1::vector<art::DexFile const*, std::__1::allocator<art::DexFile const*> > const&)+480) native: #20 pc 00000000004870f0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::Dex2Oat::Compile()+1872) native: #21 pc 000000000046cb4b /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (main+1499) native: #22 pc 0000000000029d8f /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #23 pc 0000000000029e3f /usr/lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+127) native: __libc_start_main native: ??:? native: #24 pc 00000000004155a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (???) (no managed stack frames) "Compiler driver thread pool worker thread 5" prio=5 tid=2 Native (still starting up) | group="" sCount=1 ucsCount=0 flags=1 obj=(nil) self=0x7ffff0000b70 | sysTid=1388158 nice=0 cgrp=default sched=0/0 handle=0x7ffff7888640 | state=S schedstat=( 1628207 7604419 13 ) utm=0 stm=0 core=6 HZ=100 | stack=0x7ffff7788000-0x7ffff778a000 stackSize=1028KB | held mutexes= native: #00 pc 000000000011e69b /usr/lib/x86_64-linux-gnu/libc.so.6 (syscall+27) native: syscall native: ??:? native: #01 pc 00000000006f78a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+208) native: #02 pc 0000000000e70565 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPool::GetTask(art::Thread*)+117) native: #03 pc 0000000000e6f955 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Run()+85) native: #04 pc 0000000000e6f4a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Callback(void*)+184) native: art::futex(int volatile*, int, int, timespec const*, int volatile*, int) native: art/runtime/base/mutex-inl.h:43 native: art::ConditionVariable::WaitHoldingLocks(art::Thread*) native: art/runtime/base/mutex.cc:1082 native: #05 pc 0000000000094ac2 /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #06 pc 0000000000125813 /usr/lib/x86_64-linux-gnu/libc.so.6 (clone+67) native: clone native: ??:? (no managed stack frames) "Compiler driver thread pool worker thread 1" prio=5 tid=3 Native (still starting up) | group="" sCount=1 ucsCount=0 flags=1 obj=(nil) self=0x7fffe8000b70 | sysTid=1388154 nice=0 cgrp=default sched=0/0 handle=0x7ffff7c8c640 | state=S schedstat=( 4535421 16612206 20 ) utm=0 stm=0 core=7 HZ=100 | stack=0x7ffff7b8c000-0x7ffff7b8e000 stackSize=1028KB | held mutexes= native: #00 pc 000000000011e69b /usr/lib/x86_64-linux-gnu/libc.so.6 (syscall+27) native: syscall native: ??:? native: #01 pc 00000000006f78a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+208) native: #02 pc 0000000000e70565 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPool::GetTask(art::Thread*)+117) native: #03 pc 0000000000e6f955 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Run()+85) native: art::futex(int volatile*, int, int, timespec const*, int volatile*, int) native: art/runtime/base/mutex-inl.h:43 native: art::ConditionVariable::WaitHoldingLocks(art::Thread*) native: art/runtime/base/mutex.cc:1082 native: #04 pc 0000000000e6f4a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Callback(void*)+184) native: art::ThreadPool::GetTask(art::Thread*) native: art/runtime/thread_pool.cc:269 native: art::ThreadPoolWorker::Run() native: art/runtime/thread_pool.cc:113 (discriminator 2) native: art::ThreadPoolWorker::Callback(void*) native: art/runtime/thread_pool.cc:137 native: #05 pc 0000000000094ac2 /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #06 pc 0000000000125813 /usr/lib/x86_64-linux-gnu/libc.so.6 (clone+67) native: clone native: ??:? (no managed stack frames) "Compiler driver thread pool worker thread 6" prio=5 tid=4 Native (still starting up) | group="" sCount=1 ucsCount=0 flags=1 obj=(nil) self=0x7fffec000b70 | sysTid=1388159 nice=0 cgrp=default sched=0/0 handle=0x7ffff7787640 | state=S schedstat=( 1402540 18260668 23 ) utm=0 stm=0 core=2 HZ=100 | stack=0x7ffff7687000-0x7ffff7689000 stackSize=1028KB | held mutexes= native: #00 pc 000000000011e69b /usr/lib/x86_64-linux-gnu/libc.so.6 (syscall+27) native: syscall native: ??:? native: #01 pc 00000000006f78a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+208) native: #02 pc 0000000000e70565 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPool::GetTask(art::Thread*)+117) native: #03 pc 0000000000e6f955 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Run()+85) native: #04 pc 0000000000e6f4a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Callback(void*)+184) native: art::futex(int volatile*, int, int, timespec const*, int volatile*, int) native: art/runtime/base/mutex-inl.h:43 native: art::ConditionVariable::WaitHoldingLocks(art::Thread*) native: art/runtime/base/mutex.cc:1082 native: #05 pc 0000000000094ac2 /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #06 pc 0000000000125813 /usr/lib/x86_64-linux-gnu/libc.so.6 (clone+67) native: clone native: ??:? (no managed stack frames) "Compiler driver thread pool worker thread 3" prio=5 tid=5 Native (still starting up) | group="" sCount=1 ucsCount=0 flags=1 obj=(nil) self=0x7fffe0000b70 | sysTid=1388156 nice=0 cgrp=default sched=0/0 handle=0x7ffff7a8a640 | state=S schedstat=( 3277080 24196167 37 ) utm=0 stm=0 core=7 HZ=100 | stack=0x7ffff798a000-0x7ffff798c000 stackSize=1028KB | held mutexes= native: #00 pc 000000000011e69b /usr/lib/x86_64-linux-gnu/libc.so.6 (syscall+27) native: syscall native: ??:? native: #01 pc 00000000006f78a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+208) native: #02 pc 0000000000e70565 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPool::GetTask(art::Thread*)+117) native: art::futex(int volatile*, int, int, timespec const*, int volatile*, int) native: art/runtime/base/mutex-inl.h:43 native: art::ConditionVariable::WaitHoldingLocks(art::Thread*) native: art/runtime/base/mutex.cc:1082 native: #03 pc 0000000000e6f955 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Run()+85) native: art::ThreadPool::GetTask(art::Thread*) native: art/runtime/thread_pool.cc:269 native: art::ThreadPoolWorker::Run() native: art/runtime/thread_pool.cc:113 (discriminator 2) native: #04 pc 0000000000e6f4a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Callback(void*)+184) native: art::ThreadPoolWorker::Callback(void*) native: art/runtime/thread_pool.cc:137 native: #05 pc 0000000000094ac2 /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #06 pc 0000000000125813 /usr/lib/x86_64-linux-gnu/libc.so.6 (clone+67) native: clone native: ??:? (no managed stack frames) "Compiler driver thread pool worker thread 4" prio=5 tid=6 Native (still starting up) | group="" sCount=1 ucsCount=0 flags=1 obj=(nil) self=0x7fffe4000b70 | sysTid=1388157 nice=0 cgrp=default sched=0/0 handle=0x7ffff7989640 | state=S schedstat=( 2588250 43438957 45 ) utm=0 stm=0 core=3 HZ=100 | stack=0x7ffff7889000-0x7ffff788b000 stackSize=1028KB | held mutexes= native: #00 pc 000000000011e69b /usr/lib/x86_64-linux-gnu/libc.so.6 (syscall+27) native: syscall native: ??:? native: #01 pc 00000000006f78a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+208) native: art::futex(int volatile*, int, int, timespec const*, int volatile*, int) native: art/runtime/base/mutex-inl.h:43 native: art::ConditionVariable::WaitHoldingLocks(art::Thread*) native: art/runtime/base/mutex.cc:1082 native: #02 pc 0000000000e70565 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPool::GetTask(art::Thread*)+117) native: art::ThreadPool::GetTask(art::Thread*) native: art/runtime/thread_pool.cc:269 native: #03 pc 0000000000e6f955 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Run()+85) native: art::ThreadPoolWorker::Run() native: art/runtime/thread_pool.cc:113 (discriminator 2) native: #04 pc 0000000000e6f4a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Callback(void*)+184) native: art::ThreadPoolWorker::Callback(void*) native: art/runtime/thread_pool.cc:137 native: #05 pc 0000000000094ac2 /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #06 pc 0000000000125813 /usr/lib/x86_64-linux-gnu/libc.so.6 (clone+67) native: clone native: ??:? (no managed stack frames) "Compiler driver thread pool worker thread 0" prio=5 tid=7 Native (still starting up) | group="" sCount=1 ucsCount=0 flags=1 obj=(nil) self=0x7fffd8000b70 | sysTid=1388153 nice=0 cgrp=default sched=0/0 handle=0x7ffff7d8d640 | state=S schedstat=( 2876334 47488042 58 ) utm=0 stm=0 core=3 HZ=100 | stack=0x7ffff7c8d000-0x7ffff7c8f000 stackSize=1028KB | held mutexes= native: #00 pc 000000000011e69b /usr/lib/x86_64-linux-gnu/libc.so.6 (syscall+27) native: syscall native: ??:? native: #01 pc 00000000006f78a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+208) native: art::futex(int volatile*, int, int, timespec const*, int volatile*, int) native: art/runtime/base/mutex-inl.h:43 native: art::ConditionVariable::WaitHoldingLocks(art::Thread*) native: art/runtime/base/mutex.cc:1082 native: #02 pc 0000000000e70565 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPool::GetTask(art::Thread*)+117) native: art::ThreadPool::GetTask(art::Thread*) native: art/runtime/thread_pool.cc:269 native: #03 pc 0000000000e6f955 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Run()+85) native: art::ThreadPoolWorker::Run() native: art/runtime/thread_pool.cc:113 (discriminator 2) native: #04 pc 0000000000e6f4a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Callback(void*)+184) native: art::ThreadPoolWorker::Callback(void*) native: art/runtime/thread_pool.cc:137 native: #05 pc 0000000000094ac2 /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #06 pc 0000000000125813 /usr/lib/x86_64-linux-gnu/libc.so.6 (clone+67) native: clone native: ??:? (no managed stack frames) "Compiler driver thread pool worker thread 2" prio=5 tid=8 Native (still starting up) | group="" sCount=1 ucsCount=0 flags=1 obj=(nil) self=0x7fffdc000b70 | sysTid=1388155 nice=0 cgrp=default sched=0/0 handle=0x7ffff7b8b640 | state=S schedstat=( 8578506 50476333 60 ) utm=0 stm=0 core=2 HZ=100 | stack=0x7ffff7a8b000-0x7ffff7a8d000 stackSize=1028KB | held mutexes= native: #00 pc 000000000011e69b /usr/lib/x86_64-linux-gnu/libc.so.6 (syscall+27) native: syscall native: ??:? native: #01 pc 00000000006f78a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+208) native: #02 pc 0000000000e70565 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPool::GetTask(art::Thread*)+117) native: art::futex(int volatile*, int, int, timespec const*, int volatile*, int) native: art/runtime/base/mutex-inl.h:43 native: art::ConditionVariable::WaitHoldingLocks(art::Thread*) native: art/runtime/base/mutex.cc:1082 native: #03 pc 0000000000e6f955 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Run()+85) native: art::ThreadPool::GetTask(art::Thread*) native: art/runtime/thread_pool.cc:269 native: art::ThreadPoolWorker::Run() native: art/runtime/thread_pool.cc:113 (discriminator 2) native: #04 pc 0000000000e6f4a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ThreadPoolWorker::Callback(void*)+184) native: art::ThreadPoolWorker::Callback(void*) native: art/runtime/thread_pool.cc:137 native: #05 pc 0000000000094ac2 /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #06 pc 0000000000125813 /usr/lib/x86_64-linux-gnu/libc.so.6 (clone+67) native: clone native: ??:? (no managed stack frames) dex2oatd E 01-02 17:41:39 1388115 1388115 thread-inl.h:158] holding "abort lock" at point where thread suspension is expected Aborting thread: "main" prio=5 tid=1 Runnable (still starting up) | group="" sCount=0 ucsCount=0 flags=0 obj=(nil) self=0x55555772f8f0 | sysTid=1388115 nice=0 cgrp=default sched=0/0 handle=0x7fffffc78740 | state=R schedstat=( 19533067997 13906856676 5835 ) utm=1884 stm=68 core=7 HZ=100 | stack=0x5554ff800000-0x5554ff802000 stackSize=8188KB | held mutexes= "abort lock" "mutator lock"(shared held) native: #00 pc 0000000000da5528 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (UnwindStackCurrent::UnwindFromContext(unsigned long, void*)+88) native: #01 pc 0000000000da02d8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+136) native: __compressed_pair_elem native: external/libcxx/include/memory:2140 native: __compressed_pair<true, void> native: external/libcxx/include/memory:2234 native: basic_string<nullptr_t> native: external/libcxx/include/string:820 native: UnwindStackCurrent::UnwindFromContext(unsigned long, void*) native: system/unwinding/libbacktrace/UnwindStack.cpp:169 native: #02 pc 0000000000e4582c /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+396) native: art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool) native: art/runtime/native_stack_dump.cc:335 (discriminator 2) native: #03 pc 0000000000d3991d /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*) const+93) native: #04 pc 0000000000d23136 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::Runtime::Abort(char const*)+406) native: #05 pc 000000000169e08c /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+60) native: #06 pc 000000000169dd15 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (android::base::LogMessage::~LogMessage()+341) native: #07 pc 0000000000cac4fd /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::mirror::Object* art::gc::Heap::AllocObjectWithAllocator<true, false, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>, unsigned long, art::gc::AllocatorType, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&)+2637) native: #08 pc 0000000000caba5f /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::mirror::Object* art::gc::Heap::AllocLargeObject<true, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>*, unsigned long, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&)+143) native: art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const native: art/runtime/thread.cc:2193 (discriminator 2) native: #09 pc 0000000000caa1f0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::mirror::Object* art::gc::Heap::AllocObjectWithAllocator<true, true, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>, unsigned long, art::gc::AllocatorType, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&)+1536) native: #10 pc 0000000000c9a2e9 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)+265) native: #11 pc 0000000000a5a749 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::InternTable::InternStrong(int, char const*)+121) native: #12 pc 000000000075b6e1 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ClassLinker::DoResolveString(art::dex::StringIndex, art::Handle<art::mirror::DexCache>)+81) native: #13 pc 00000000004b055b /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::ClassLinker::ResolveString(art::dex::StringIndex, art::Handle<art::mirror::DexCache>)+251) native: art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*) const native: art/runtime/runtime.cc:569 native: art::Dumpable<art::AbortState>::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const native: art/libartbase/base/dumpable.h:38 native: std::__1::basic_ostream<char, std::__1::char_traits<char> >& art::operator<< <art::AbortState>(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Dumpable<art::AbortState> const&) native: art/libartbase/base/dumpable.h:49 native: art::Runtime::Abort(char const*) native: art/runtime/runtime.cc:671 native: std::__1::__function::__value_func<void (char const*)>::operator()(char const*&&) const native: external/libcxx/include/functional:1799 (discriminator 2) native: std::__1::function<void (char const*)>::operator()(char const*) const native: external/libcxx/include/functional:2347 (discriminator 2) native: operator() native: system/libbase/logging.cpp:416 (discriminator 2) native: __invoke native: system/libbase/logging.cpp:416 (discriminator 2) native: ~LogMessage native: system/libbase/logging.cpp:504 (discriminator 2) native: #14 pc 00000000004a28d6 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::CompilerDriver::ResolveConstStrings(std::__1::vector<art::DexFile const*, std::__1::allocator<art::DexFile const*> > const&, bool, art::TimingLogger*)+1846) native: #15 pc 00000000004a32d5 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::CompilerDriver::PreCompile(_jobject*, std::__1::vector<art::DexFile const*, std::__1::allocator<art::DexFile const*> > const&, art::TimingLogger*, art::HashSet<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, art::DefaultEmptyFn<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, art::DataHash, art::DefaultStringEquals, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, art::VerificationResults*)+629) native: art::ObjPtr<art::mirror::Object>::Encode(art::mirror::Object*) native: art/runtime/obj_ptr-inl.h:58 (discriminator 36) native: art::ObjPtr<art::mirror::Object>::Assign(art::mirror::Object*) native: art/runtime/obj_ptr-inl.h:102 (discriminator 36) native: art::ObjPtr<art::mirror::Object>::operator=(art::mirror::Object*) native: art/runtime/obj_ptr-inl.h:96 (discriminator 36) native: art::mirror::Object* art::gc::Heap::AllocObjectWithAllocator<true, false, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>, unsigned long, art::gc::AllocatorType, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&) native: art/runtime/gc/heap-inl.h:143 (discriminator 36) native: art::mirror::Object* art::gc::Heap::AllocLargeObject<true, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>*, unsigned long, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&) native: art/runtime/gc/heap-inl.h:290 native: art::mirror::Object* art::gc::Heap::AllocObjectWithAllocator<true, true, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, art::ObjPtr<art::mirror::Class>, unsigned long, art::gc::AllocatorType, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&) native: art/runtime/gc/heap-inl.h:98 native: art::ObjPtr<art::mirror::String> art::mirror::String::Alloc<true, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3>(art::Thread*, int, art::gc::AllocatorType, art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int)::$_3 const&) native: art/runtime/mirror/string-alloc-inl.h:195 native: art::mirror::String::AllocFromModifiedUtf8(art::Thread*, int, char const*, int) native: art/runtime/mirror/string.cc:211 native: #16 pc 000000000048a5a0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::Dex2Oat::CompileDexFiles(std::__1::vector<art::DexFile const*, std::__1::allocator<art::DexFile const*> > const&)+480) native: art::InternTable::InternStrong(int, char const*) native: art/runtime/intern_table.cc:264 native: #17 pc 00000000004870f0 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (art::Dex2Oat::Compile()+1872) native: #18 pc 000000000046cb4b /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (main+1499) native: #19 pc 0000000000029d8f /usr/lib/x86_64-linux-gnu/libc.so.6 (???) native: #20 pc 0000000000029e3f /usr/lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+127) native: __libc_start_main native: ??:? native: #21 pc 00000000004155a8 /home/ubuntu/aosp/out/soong/host/linux-x86/bin/dex2oatd64 (???) (no managed stack frames) Aborted (core dumped) ERROR: Dex2oat failed to compile a boot image.It is likely that the boot classpath is inconsistent.Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors. [ 99% 104066/104178] //packages/modules/Wifi/service:service-wifi r8 [apex30] Warning: Missing class android.compat.annotation.UnsupportedAppUsage (referenced from: void com.android.server.wifi.util.XmlUtilHelper.beginDocument(org.xmlpull.v1.XmlPullParser, java.lang.String) and 6 other contexts) Missing class com.google.errorprone.annotations.CompileTimeConstant (referenced from: com.android.server.wifi.WifiLog$LogMessage com.android.server.wifi.WifiLog.dump(java.lang.String) and 9 other contexts) Missing class javax.annotation.CheckReturnValue (referenced from: com.android.server.wifi.WifiLog$LogMessage com.android.server.wifi.WifiLog$LogMessage.c(char) and 10 other contexts) Missing class javax.annotation.Nullable (referenced from: android.net.wifi.SoftApConfiguration com.android.server.wifi.SoftApModeConfiguration.mSoftApConfig and 5 other contexts) Missing class javax.annotation.concurrent.GuardedBy (referenced from: android.app.AlarmManager$OnAlarmListener com.android.server.wifi.scanner.WificondScannerImpl.mScanTimeoutListener) Missing class javax.annotation.concurrent.NotThreadSafe (referenced from: com.android.server.wifi.NetworkSuggestionNominator and 5 other contexts) Missing class javax.annotation.concurrent.ThreadSafe (referenced from: com.android.server.wifi.Clock and 6 other contexts) [ 99% 104067/104178] //packages/apps/Settings:Settings r8 Warning: Missing class android.support.annotation.Nullable (referenced from: com.android.settings.intelligence.ContextualCardProto$ContextualCardList com.google.android.settings.intelligence.libs.contextualcards.ContextualCardProvider.getContextualCards()) Missing class androidx.palette.graphics.Palette$Builder (referenced from: android.graphics.Bitmap androidx.mediarouter.app.MediaRouteControllerDialog$FetchArtTask.doInBackground(java.lang.Void[]) and 1 other context) Missing class androidx.palette.graphics.Palette$Swatch (referenced from: android.graphics.Bitmap androidx.mediarouter.app.MediaRouteControllerDialog$FetchArtTask.doInBackground(java.lang.Void[]) and 1 other context) Missing class androidx.palette.graphics.Palette (referenced from: android.graphics.Bitmap androidx.mediarouter.app.MediaRouteControllerDialog$FetchArtTask.doInBackground(java.lang.Void[]) and 1 other context) Missing class com.android.internal.telephony.MccTable (referenced from: java.lang.String com.android.settings.network.SubscriptionUtil.getFormattedPhoneNumber(android.content.Context, android.telephony.SubscriptionInfo)) Missing class com.google.errorprone.annotations.CanIgnoreReturnValue (referenced from: java.lang.Object com.google.common.base.AbstractIterator.endOfData() and 135 other contexts) Missing class com.google.errorprone.annotations.CompatibleWith (referenced from: boolean com.google.common.collect.Multimap.containsEntry(java.lang.Object, java.lang.Object) and 1 other context) Missing class com.google.errorprone.annotations.DoNotMock (referenced from: com.google.common.base.Optional and 9 other contexts) Missing class com.google.errorprone.annotations.ForOverride (referenced from: boolean com.google.common.base.Equivalence.doEquivalent(java.lang.Object, java.lang.Object) and 2 other contexts) Missing class com.google.errorprone.annotations.Immutable (referenced from: com.google.common.net.InternetDomainName) Missing class com.google.errorprone.annotations.concurrent.GuardedBy (referenced from: void com.google.common.collect.MapMakerInternalMap$Segment.drainKeyReferenceQueue(java.lang.ref.ReferenceQueue) and 5 other contexts) Missing class com.google.errorprone.annotations.concurrent.LazyInit (referenced from: com.google.common.collect.ImmutableSet com.google.common.collect.ImmutableMap.entrySet and 5 other contexts) Missing class kotlinx.coroutines.channels.BufferOverflow (referenced from: java.lang.Object androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invokeSuspend(java.lang.Object)) Missing class kotlinx.coroutines.channels.Channel (referenced from: java.lang.Object androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invokeSuspend(java.lang.Object) and 1 other context) Missing class kotlinx.coroutines.channels.ChannelIterator (referenced from: java.lang.Object androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invokeSuspend(java.lang.Object)) Missing class kotlinx.coroutines.channels.ChannelKt (referenced from: java.lang.Object androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invokeSuspend(java.lang.Object)) Missing class kotlinx.coroutines.flow.Flow (referenced from: kotlinx.coroutines.flow.Flow androidx.window.layout.WindowInfoTracker.windowLayoutInfo(android.app.Activity) and 1 other context) Missing class kotlinx.coroutines.flow.FlowCollector (referenced from: java.lang.Object androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invoke(java.lang.Object, java.lang.Object) and 2 other contexts) Missing class kotlinx.coroutines.flow.FlowKt (referenced from: kotlinx.coroutines.flow.Flow androidx.window.layout.WindowInfoTrackerImpl.windowLayoutInfo(android.app.Activity)) Missing class org.jetbrains.annotations.NotNull (referenced from: androidx.window.core.Version androidx.window.core.Version.CURRENT and 636 other contexts) Missing class org.jetbrains.annotations.Nullable (referenced from: java.lang.String androidx.window.embedding.ActivityFilter.intentAction and 119 other contexts) [ 99% 104068/104178] //frameworks/base/packages/SystemUI:SystemUI-core kapt WARN: The registry key 'java.correct.class.type.by.place.resolve.scope' accessed, but not loaded yet warning: some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath out/soong/.intermediates/external/kotlinx.coroutines/kotlinx_coroutines/android_common/turbine-combined/kotlinx_coroutines.jar: warning: library has Kotlin runtime bundled into it out/soong/.intermediates/external/kotlinx.coroutines/kotlinx_coroutines_android/android_common/turbine-combined/kotlinx_coroutines_android.jar: warning: library has Kotlin runtime bundled into it out/soong/.intermediates/external/lottie/lottie/android_common/turbine-combined/lottie.jar: warning: library has Kotlin runtime bundled into it out/soong/.intermediates/frameworks/base/libs/WindowManager/Shell/WindowManager-Shell/android_common/combined/WindowManager-Shell.jar: warning: library has Kotlin runtime bundled into it out/soong/.intermediates/frameworks/base/packages/SettingsLib/SettingsLib/android_common/turbine-combined/SettingsLib.jar: warning: library has Kotlin runtime bundled into it out/soong/.intermediates/frameworks/base/packages/SystemUI/animation/SystemUIAnimationLib/android_common/turbine-combined/SystemUIAnimationLib.jar: warning: library has Kotlin runtime bundled into it out/soong/.intermediates/frameworks/base/packages/SystemUI/monet/monet/android_common/turbine-combined/monet.jar: warning: library has Kotlin runtime bundled into it out/soong/.intermediates/frameworks/base/packages/SystemUI/plugin/SystemUIPluginLib/android_common/turbine-combined/SystemUIPluginLib.jar: warning: library has Kotlin runtime bundled into it out/soong/.intermediates/frameworks/base/packages/SystemUI/shared/SystemUISharedLib/android_common/turbine-combined/SystemUISharedLib.jar: warning: library has Kotlin runtime bundled into it warning: /home/ubuntu/aosp/frameworks/base/packages/SystemUI/src/com/android/systemui/dagger/GlobalRootComponent.java:34: warning: [Dagger/DuplicateBindings] com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment is bound multiple times: public interface GlobalRootComponent { ^ @Inject com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment(com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.Factory, com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController, com.android.systemui.statusbar.events.SystemStatusAnimationScheduler, com.android.systemui.statusbar.phone.StatusBarLocationPublisher, com.android.systemui.statusbar.phone.NotificationIconAreaController, com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManager, com.android.systemui.flags.FeatureFlags, com.android.systemui.statusbar.phone.StatusBarIconController, com.android.systemui.statusbar.phone.StatusBarHideIconsForBouncerManager, com.android.systemui.statusbar.policy.KeyguardStateController, com.android.systemui.statusbar.phone.NotificationPanelViewController, com.android.systemui.statusbar.connectivity.NetworkController, com.android.systemui.plugins.statusbar.StatusBarStateController, com.android.systemui.statusbar.CommandQueue, com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragmentLogger, com.android.systemui.statusbar.OperatorNameViewController.Factory) [com.android.systemui.dagger.GlobalRootComponent → com.android.systemui.dagger.SysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent] com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.Factory.create(collapsedStatusBarFragment) [com.android.systemui.dagger.GlobalRootComponent → com.android.systemui.dagger.SysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] This condition was never validated before, and will soon be an error. See https://dagger.dev/conflicting-inject. com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment is injected at com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentModule.providePhoneStatusBarView(collapsedStatusBarFragment) @com.android.systemui.dagger.qualifiers.RootView com.android.systemui.statusbar.phone.PhoneStatusBarView is requested at com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.getPhoneStatusBarView() [com.android.systemui.dagger.GlobalRootComponent → com.android.systemui.dagger.SysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] The following other entry points also depend on it: com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.getBatteryMeterViewController() [com.android.systemui.dagger.GlobalRootComponent → com.android.systemui.dagger.SysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.getPhoneStatusBarViewController() [com.android.systemui.dagger.GlobalRootComponent → com.android.systemui.dagger.SysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.getHeadsUpAppearanceController() [com.android.systemui.dagger.GlobalRootComponent → com.android.systemui.dagger.SysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] warning: /home/ubuntu/aosp/frameworks/base/packages/SystemUI/src/com/android/systemui/tv/TvGlobalRootComponent.java:36: warning: [Dagger/DuplicateBindings] com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment is bound multiple times: public interface TvGlobalRootComponent extends GlobalRootComponent { ^ @Inject com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment(com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.Factory, com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController, com.android.systemui.statusbar.events.SystemStatusAnimationScheduler, com.android.systemui.statusbar.phone.StatusBarLocationPublisher, com.android.systemui.statusbar.phone.NotificationIconAreaController, com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManager, com.android.systemui.flags.FeatureFlags, com.android.systemui.statusbar.phone.StatusBarIconController, com.android.systemui.statusbar.phone.StatusBarHideIconsForBouncerManager, com.android.systemui.statusbar.policy.KeyguardStateController, com.android.systemui.statusbar.phone.NotificationPanelViewController, com.android.systemui.statusbar.connectivity.NetworkController, com.android.systemui.plugins.statusbar.StatusBarStateController, com.android.systemui.statusbar.CommandQueue, com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragmentLogger, com.android.systemui.statusbar.OperatorNameViewController.Factory) [com.android.systemui.tv.TvGlobalRootComponent → com.android.systemui.tv.TvSysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent] com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.Factory.create(collapsedStatusBarFragment) [com.android.systemui.tv.TvGlobalRootComponent → com.android.systemui.tv.TvSysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] This condition was never validated before, and will soon be an error. See https://dagger.dev/conflicting-inject. com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment is injected at com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentModule.providePhoneStatusBarView(collapsedStatusBarFragment) @com.android.systemui.dagger.qualifiers.RootView com.android.systemui.statusbar.phone.PhoneStatusBarView is requested at com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.getPhoneStatusBarView() [com.android.systemui.tv.TvGlobalRootComponent → com.android.systemui.tv.TvSysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] The following other entry points also depend on it: com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.getBatteryMeterViewController() [com.android.systemui.tv.TvGlobalRootComponent → com.android.systemui.tv.TvSysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.getPhoneStatusBarViewController() [com.android.systemui.tv.TvGlobalRootComponent → com.android.systemui.tv.TvSysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent.getHeadsUpAppearanceController() [com.android.systemui.tv.TvGlobalRootComponent → com.android.systemui.tv.TvSysUIComponent → com.android.systemui.statusbar.phone.dagger.StatusBarComponent → com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent] 17:44:08 ninja failed with: exit status 1 #### failed to build some targets (08:03:33 (hh:mm:ss)) #### |
这个问题解决比较简单,直接在编译命令里面禁止 DEXPREOPT 即可,参考 Compiling a deodexed AOSP? 。
如下:
1 2 3 4 5 6 7 |
# 禁止 DEX 文件编译期预先代码转换 # 这个优化的目的是提高系统第一次启动速度,这个优化选项目前一定会编译失败 # Android 12 配置文件在 build/core/dex_preopt_config.mk # 但是修改需要在编译目标的 BoardConfig.mk 尾部增加, # 环境变量里面配置 'export WITH_DEXPREOPT=false' 无效 $ sed -i '$a\WITH_DEXPREOPT := false' build/target/board/emulator_arm64/BoardConfig.mk |
其他错误
如果是编译 Android 12.0 以下的源代码,则可能会长时间卡住在 link 命令,结束不了,如下:
1 2 3 4 5 6 7 8 9 10 |
[ 82% 93325/112509] //system/libhidl:libhidlbase link libhidlbase.so [com.android.media.swcodec] 80:55 //system/libhidl:libhidlbase link libhidlbase.so 8:47 //external/perfetto:libperfetto link libperfetto.so 7:50 //external/perfetto:heapprofd link heapprofd 7:50 //external/perfetto:heapprofd_client link heapprofd_client.so 7:49 //external/perfetto:heapprofd_client link heapprofd_client.so [arm] 7:47 //external/vixl:libvixl link libvixl.so [com.android.art.debug] 7:46 //external/vixl:libvixl link libvixl.so [arm com.android.art.debug] 7:41 //frameworks/av/media/extractors/mpeg2:libmpeg2extractor link libmpeg2extractor.so [com.android.media] 7:41 //frameworks/ml/nn/runtime:libneuralnetworks link libneuralnetworks.so [com.android.neuralnetworks] |
观察构建日志,会发现在如下命令卡住:
1 2 3 4 5 6 7 8 |
ubuntu@ubuntu:~/aosp$ cat out/soong.log ....................................................................... | | `-ld.lld,772339 /home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld -z noexecstack -EL --fix-cortex-a53-843419 --warn-shared-textrel -z now -z relro -z max-page-size=4096 --hash-style=gnu --enable-new-dtags --eh-frame-hdr -m aarch64linux -shared -o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_shared/unstripped/libhidlbase.so -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/aarch64 -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/../lib64 -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/../lib -L/lib -L/usr/lib out/soong/.intermediates/bionic/libc/crtbegin_so/android_vendor.30_arm64_armv8-a/crtbegin_so.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/base/HidlInternal.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/base/HidlSupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/base/Status.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/base/TaskRunner.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/transport/HidlBinderSupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/transport/HidlLazyUtils.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/transport/HidlPassthroughSupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/transport/HidlTransportSupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/transport/HidlTransportUtils.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/transport/LegacySupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/transport/ServiceManagement.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/system/libhidl/transport/Static.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/.intermediates/system/libhidl/transport/manager/1.0/android.hidl.manager@1.0_genc++/gen/android/hidl/manager/1.0/ServiceManagerAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/.intermediates/system/libhidl/transport/manager/1.0/android.hidl.manager@1.0_genc++/gen/android/hidl/manager/1.0/ServiceNotificationAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/.intermediates/system/libhidl/transport/manager/1.1/android.hidl.manager@1.1_genc++/gen/android/hidl/manager/1.1/ServiceManagerAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/.intermediates/system/libhidl/transport/manager/1.2/android.hidl.manager@1.2_genc++/gen/android/hidl/manager/1.2/ClientCallbackAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/.intermediates/system/libhidl/transport/manager/1.2/android.hidl.manager@1.2_genc++/gen/android/hidl/manager/1.2/ServiceManagerAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/.intermediates/system/libhidl/transport/base/1.0/android.hidl.base@1.0_genc++/gen/android/hidl/base/1.0/BaseAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static/obj/.intermediates/system/libhidl/transport/base/1.0/android.hidl.base@1.0_genc++/gen/android/hidl/base/1.0/types.o prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a --whole-archive out/soong/.intermediates/system/libhwbinder/libhwbinder-impl-internal/android_vendor.30_arm64_armv8-a_static/libhwbinder-impl-internal.a --no-whole-archive out/soong/.intermediates/system/libhwbinder/libhwbinder-impl-internal/android_vendor.30_arm64_armv8-a_static/libhwbinder-impl-internal.a out/soong/.intermediates/external/libcxxabi/libc++demangle/android_vendor.30_arm64_armv8-a_static/libc++demangle.a prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.builtins-aarch64-android.a prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/lib64/libatomic.a out/soong/.intermediates/system/core/base/libbase/android_vendor.30_arm64_armv8-a_shared/libbase.so out/soong/.intermediates/system/core/liblog/liblog.llndk/android_vendor.30_arm64_armv8-a_shared/liblog.so out/soong/.intermediates/system/core/libutils/libutils/android_vendor.30_arm64_armv8-a_shared/libutils.so out/soong/.intermediates/system/core/libcutils/libcutils/android_vendor.30_arm64_armv8-a_shared/libcutils.so out/soong/.intermediates/system/core/libvndksupport/libvndksupport.llndk/android_vendor.30_arm64_armv8-a_shared/libvndksupport.so out/soong/.intermediates/external/libcxx/libc++/android_vendor.30_arm64_armv8-a_shared/libc++.so out/soong/.intermediates/bionic/libc/libc.llndk/android_vendor.30_arm64_armv8-a_shared/libc.so out/soong/.intermediates/bionic/libm/libm.llndk/android_vendor.30_arm64_armv8-a_shared/libm.so out/soong/.intermediates/bionic/libdl/libdl.llndk/android_vendor.30_arm64_armv8-a_shared/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_vendor.30_arm64_armv8-a/obj/bionic/libc/arch-common/bionic/crtend_so.o -z noexecstack -z relro -z now --build-id=md5 --warn-shared-textrel --fatal-warnings --no-undefined-version --exclude-libs libgcc.a --exclude-libs libgcc_stripped.a --exclude-libs libunwind_llvm.a --pack-dyn-relocs=android+relr --use-android-relr-tags --no-undefined --hash-style=gnu -z separate-code --icf=safe -z max-page-size=4096 --exclude-libs=libclang_rt.builtins-aarch64-android.a --gc-sections -soname libhidlbase.so prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a --exclude-libs libclang_rt.ubsan_minimal-aarch64-android.a --exclude-libs libclang_rt.ubsan_minimal-aarch64-android.a | `-sh,774089 -c prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++ out/soong/.intermediates/bionic/libc/crtbegin_so/android_vendor.30_arm64_armv8-a_com.android.media.swcodec/crtbegin_so.o @out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/unstripped/libhidlbase.so.rsp prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a -Wl,--whole-archive out/soong/.intermediates/system/libhwbinder/libhwbinder-impl-internal/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libhwbinder-impl-internal.a -Wl,--no-whole-archive out/soong/.intermediates/system/libhwbinder/libhwbinder-impl-internal/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libhwbinder-impl-internal.a out/soong/.intermediates/external/libcxxabi/libc++demangle/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libc++demangle.a out/soong/.intermediates/build/soong/libgcc_stripped/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libgcc_stripped.a prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.builtins-aarch64-android.a prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/lib64/libatomic.a out/soong/.intermediates/system/core/base/libbase/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libbase.so out/soong/.intermediates/system/core/liblog/liblog.llndk/android_vendor.30_arm64_armv8-a_shared_29/liblog.so out/soong/.intermediates/system/core/libutils/libutils/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libutils.so out/soong/.intermediates/system/core/libcutils/libcutils/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libcutils.so out/soong/.intermediates/system/core/libvndksupport/libvndksupport.llndk/android_vendor.30_arm64_armv8-a_shared_29/libvndksupport.so out/soong/.intermediates/external/libcxx/libc++/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libc++.so out/soong/.intermediates/bionic/libc/libc.llndk/android_vendor.30_arm64_armv8-a_shared_29/libc.so out/soong/.intermediates/bionic/libm/libm.llndk/android_vendor.30_arm64_armv8-a_shared_29/libm.so out/soong/.intermediates/bionic/libdl/libdl.llndk/android_vendor.30_arm64_armv8-a_shared_29/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_vendor.30_arm64_armv8-a_com.android.media.swcodec/obj/bionic/libc/arch-common/bionic/crtend_so.o -o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/unstripped/libhidlbase.so -target aarch64-linux-android30 -Bprebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5 -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_stripped.a -Wl,--exclude-libs,libunwind_llvm.a -fuse-ld=lld -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags -Wl,--no-undefined -Wl,--hash-style=gnu -Wl,-z,separate-code -Wl,--icf=safe -Wl,-z,max-page-size=4096 -Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a -nostdlib -Wl,--gc-sections -shared -Wl,-soname,libhidlbase.so prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a -Wl,--exclude-libs,libclang_rt.ubsan_minimal-aarch64-android.a -Wl,--exclude-libs,libclang_rt.ubsan_minimal-aarch64-android.a | `-clang++.real,774090 prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++.real out/soong/.intermediates/bionic/libc/crtbegin_so/android_vendor.30_arm64_armv8-a_com.android.media.swcodec/crtbegin_so.o @out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/unstripped/libhidlbase.so.rsp prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a -Wl,--whole-archive out/soong/.intermediates/system/libhwbinder/libhwbinder-impl-internal/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libhwbinder-impl-internal.a -Wl,--no-whole-archive out/soong/.intermediates/system/libhwbinder/libhwbinder-impl-internal/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libhwbinder-impl-internal.a out/soong/.intermediates/external/libcxxabi/libc++demangle/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libc++demangle.a out/soong/.intermediates/build/soong/libgcc_stripped/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libgcc_stripped.a prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.builtins-aarch64-android.a prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/lib64/libatomic.a out/soong/.intermediates/system/core/base/libbase/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libbase.so out/soong/.intermediates/system/core/liblog/liblog.llndk/android_vendor.30_arm64_armv8-a_shared_29/liblog.so out/soong/.intermediates/system/core/libutils/libutils/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libutils.so out/soong/.intermediates/system/core/libcutils/libcutils/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libcutils.so out/soong/.intermediates/system/core/libvndksupport/libvndksupport.llndk/android_vendor.30_arm64_armv8-a_shared_29/libvndksupport.so out/soong/.intermediates/external/libcxx/libc++/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libc++.so out/soong/.intermediates/bionic/libc/libc.llndk/android_vendor.30_arm64_armv8-a_shared_29/libc.so out/soong/.intermediates/bionic/libm/libm.llndk/android_vendor.30_arm64_armv8-a_shared_29/libm.so out/soong/.intermediates/bionic/libdl/libdl.llndk/android_vendor.30_arm64_armv8-a_shared_29/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_vendor.30_arm64_armv8-a_com.android.media.swcodec/obj/bionic/libc/arch-common/bionic/crtend_so.o -o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/unstripped/libhidlbase.so -target aarch64-linux-android30 -Bprebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5 -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_stripped.a -Wl,--exclude-libs,libunwind_llvm.a -fuse-ld=lld -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags -Wl,--no-undefined -Wl,--hash-style=gnu -Wl,-z,separate-code -Wl,--icf=safe -Wl,-z,max-page-size=4096 -Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a -nostdlib -Wl,--gc-sections -shared -Wl,-soname,libhidlbase.so prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a -Wl,--exclude-libs,libclang_rt.ubsan_minimal-aarch64-android.a -Wl,--exclude-libs,libclang_rt.ubsan_minimal-aarch64-android.a | `-ld.lld,774095 /home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld -z noexecstack -EL --fix-cortex-a53-843419 --warn-shared-textrel -z now -z relro -z max-page-size=4096 --hash-style=gnu --enable-new-dtags --eh-frame-hdr -m aarch64linux -shared -o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/unstripped/libhidlbase.so -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/aarch64 -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/../lib64 -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/../lib -L/lib -L/usr/lib out/soong/.intermediates/bionic/libc/crtbegin_so/android_vendor.30_arm64_armv8-a_com.android.media.swcodec/crtbegin_so.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/base/HidlInternal.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/base/HidlSupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/base/Status.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/base/TaskRunner.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/transport/HidlBinderSupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/transport/HidlLazyUtils.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/transport/HidlPassthroughSupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/transport/HidlTransportSupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/transport/HidlTransportUtils.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/transport/LegacySupport.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/transport/ServiceManagement.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/system/libhidl/transport/Static.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/.intermediates/system/libhidl/transport/manager/1.0/android.hidl.manager@1.0_genc++/gen/android/hidl/manager/1.0/ServiceManagerAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/.intermediates/system/libhidl/transport/manager/1.0/android.hidl.manager@1.0_genc++/gen/android/hidl/manager/1.0/ServiceNotificationAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/.intermediates/system/libhidl/transport/manager/1.1/android.hidl.manager@1.1_genc++/gen/android/hidl/manager/1.1/ServiceManagerAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/.intermediates/system/libhidl/transport/manager/1.2/android.hidl.manager@1.2_genc++/gen/android/hidl/manager/1.2/ClientCallbackAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/.intermediates/system/libhidl/transport/manager/1.2/android.hidl.manager@1.2_genc++/gen/android/hidl/manager/1.2/ServiceManagerAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/.intermediates/system/libhidl/transport/base/1.0/android.hidl.base@1.0_genc++/gen/android/hidl/base/1.0/BaseAll.o out/soong/.intermediates/system/libhidl/libhidlbase/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/obj/.intermediates/system/libhidl/transport/base/1.0/android.hidl.base@1.0_genc++/gen/android/hidl/base/1.0/types.o prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a --whole-archive out/soong/.intermediates/system/libhwbinder/libhwbinder-impl-internal/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libhwbinder-impl-internal.a --no-whole-archive out/soong/.intermediates/system/libhwbinder/libhwbinder-impl-internal/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libhwbinder-impl-internal.a out/soong/.intermediates/external/libcxxabi/libc++demangle/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libc++demangle.a out/soong/.intermediates/build/soong/libgcc_stripped/android_vendor.30_arm64_armv8-a_static_com.android.media.swcodec/libgcc_stripped.a prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.builtins-aarch64-android.a prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/lib64/libatomic.a out/soong/.intermediates/system/core/base/libbase/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libbase.so out/soong/.intermediates/system/core/liblog/liblog.llndk/android_vendor.30_arm64_armv8-a_shared_29/liblog.so out/soong/.intermediates/system/core/libutils/libutils/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libutils.so out/soong/.intermediates/system/core/libcutils/libcutils/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libcutils.so out/soong/.intermediates/system/core/libvndksupport/libvndksupport.llndk/android_vendor.30_arm64_armv8-a_shared_29/libvndksupport.so out/soong/.intermediates/external/libcxx/libc++/android_vendor.30_arm64_armv8-a_shared_com.android.media.swcodec/libc++.so out/soong/.intermediates/bionic/libc/libc.llndk/android_vendor.30_arm64_armv8-a_shared_29/libc.so out/soong/.intermediates/bionic/libm/libm.llndk/android_vendor.30_arm64_armv8-a_shared_29/libm.so out/soong/.intermediates/bionic/libdl/libdl.llndk/android_vendor.30_arm64_armv8-a_shared_29/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_vendor.30_arm64_armv8-a_com.android.media.swcodec/obj/bionic/libc/arch-common/bionic/crtend_so.o -z noexecstack -z relro -z now --build-id=md5 --warn-shared-textrel --fatal-warnings --no-undefined-version --exclude-libs libgcc.a --exclude-libs libgcc_stripped.a --exclude-libs libunwind_llvm.a --pack-dyn-relocs=android+relr --use-android-relr-tags --no-undefined --hash-style=gnu -z separate-code --icf=safe -z max-page-size=4096 --exclude-libs=libclang_rt.builtins-aarch64-android.a --gc-sections -soname libhidlbase.so prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a --exclude-libs libclang_rt.ubsan_minimal-aarch64-android.a --exclude-libs libclang_rt.ubsan_minimal-aarch64-android.a |
我们手工执行这些卡住的命令,也是照样卡住,如下:
1 |
ubuntu@ubuntu:~/aosp$ /home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++.real out/soong/.intermediates/bionic/libc/crtbegin_so/android_arm_armv8-a_com.android.art.debug/crtbegin_so.o @out/soong/.intermediates/external/vixl/libvixl/android_arm_armv8-a_shared_com.android.art.debug/unstripped/libvixl.so.rsp out/soong/.intermediates/external/libcxxabi/libc++demangle/android_arm_armv8-a_static_lto-thin_com.android.art.debug/libc++demangle.a prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.builtins-arm-android.a prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/lib/libatomic.a out/soong/.intermediates/external/libcxx/libc++/android_arm_armv8-a_shared_com.android.art.debug/libc++.so out/soong/.intermediates/bionic/libc/libc/android_arm_armv8-a_shared_10000/libc.so out/soong/.intermediates/bionic/libm/libm/android_arm_armv8-a_shared_10000/libm.so out/soong/.intermediates/bionic/libdl/libdl/android_arm_armv8-a_shared_10000/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_arm_armv8-a_com.android.art.debug/obj/bionic/libc/arch-common/bionic/crtend_so.o -o out/soong/.intermediates/external/vixl/libvixl/android_arm_armv8-a_shared_com.android.art.debug/unstripped/libvixl.so -target armv7a-linux-androideabi10000 -Bprebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5 -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_stripped.a -Wl,--exclude-libs,libunwind_llvm.a -fuse-ld=lld -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags -Wl,--no-undefined -Wl,--icf=safe -Wl,--hash-style=gnu -Wl,-m,armelf -Wl,--exclude-libs=libclang_rt.builtins-arm-android.a -nostdlib -Wl,--gc-sections -shared -Wl,-soname,libvixl.so -Wl,--exclude-libs,libunwind_llvm.a -flto=thin -fsplit-lto-unit -fprofile-use=toolchain/pgo-profiles/art/dex2oat_arm_arm64.profdata.2020-06-02 -Wno-backend-plugin |
于是执行观察进程信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
ubuntu@ubuntu:~$ ps -A | grep ld 164 ? 00:00:00 kthrotld 167 ? 00:00:00 mld 173329 pts/0 00:00:00 ld.lld 202622 pts/0 00:00:00 ld.lld 213495 pts/0 00:00:00 ld.lld 213548 pts/0 00:00:00 ld.lld 213900 pts/0 00:00:00 ld.lld 214713 pts/0 00:00:00 ld.lld 214789 pts/0 00:00:00 ld.lld 215848 pts/0 00:00:00 ld.lld 218993 pts/0 00:00:14 ld.lld 219011 pts/0 00:00:00 ld.lld 220320 pts/0 00:00:00 ld.lld 221908 pts/0 00:00:00 ld.lld 222517 pts/0 00:00:00 ld.lld 224287 pts/0 00:00:00 ld.lld 652624 pts/0 00:00:00 ld.lld 752485 pts/0 00:00:01 ld.lld 763478 pts/0 00:00:00 ld.lld 763483 pts/0 00:00:00 ld.lld 763741 pts/0 00:00:00 ld.lld 764270 pts/0 00:00:00 ld.lld 764453 pts/0 00:00:00 ld.lld 765278 pts/0 00:00:22 ld.lld 765319 pts/0 00:00:00 ld.lld 767095 pts/0 00:00:00 ld.lld 769867 pts/0 00:00:00 ld.lld 771731 pts/0 00:00:01 ld.lld 772339 pts/0 00:00:00 ld.lld 774095 pts/0 00:00:00 ld.lld 788714 pts/0 00:00:00 ld.lld |
可以看到相当多的进程卡住了。
随便选择一个进程,查看进程当前卡住的地方
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
ubuntu@ubuntu:~$ sudo apt install strace ubuntu@ubuntu:~$ sudo strace -p 774095 strace: Process 580996 attached futex(0xf529b70, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY ubuntu@ubuntu:~$ sudo cat /proc/774095/stack [<0>] __switch_to+0xf8/0x150 [<0>] futex_wait_queue_me+0xbc/0x14c [<0>] futex_wait+0xd4/0x240 [<0>] do_futex+0x118/0x1cc [<0>] __arm64_sys_futex+0x7c/0x190 [<0>] invoke_syscall+0x78/0x100 [<0>] el0_svc_common.constprop.0+0x54/0x184 [<0>] do_el0_svc+0x30/0xac [<0>] el0_svc+0x48/0x160 [<0>] el0t_64_sync_handler+0xa4/0x130 [<0>] el0t_64_sync+0x1a4/0x1a8 |
可以发现都是卡住在相同的地方。
比如,如下命令:
1 |
ubuntu@ubuntu:~/aosp$ /home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++.real out/soong/.intermediates/bionic/libc/crtbegin_so/android_arm_armv8-a_com.android.art.debug/crtbegin_so.o @out/soong/.intermediates/external/vixl/libvixl/android_arm_armv8-a_shared_com.android.art.debug/unstripped/libvixl.so.rsp out/soong/.intermediates/external/libcxxabi/libc++demangle/android_arm_armv8-a_static_lto-thin_com.android.art.debug/libc++demangle.a prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.builtins-arm-android.a prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/lib/libatomic.a out/soong/.intermediates/external/libcxx/libc++/android_arm_armv8-a_shared_com.android.art.debug/libc++.so out/soong/.intermediates/bionic/libc/libc/android_arm_armv8-a_shared_10000/libc.so out/soong/.intermediates/bionic/libm/libm/android_arm_armv8-a_shared_10000/libm.so out/soong/.intermediates/bionic/libdl/libdl/android_arm_armv8-a_shared_10000/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_arm_armv8-a_com.android.art.debug/obj/bionic/libc/arch-common/bionic/crtend_so.o -o out/soong/.intermediates/external/vixl/libvixl/android_arm_armv8-a_shared_com.android.art.debug/unstripped/libvixl.so -target armv7a-linux-androideabi10000 -Bprebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5 -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_stripped.a -Wl,--exclude-libs,libunwind_llvm.a -fuse-ld=lld -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags -Wl,--no-undefined -Wl,--icf=safe -Wl,--hash-style=gnu -Wl,-m,armelf -Wl,--exclude-libs=libclang_rt.builtins-arm-android.a -nostdlib -Wl,--gc-sections -shared -Wl,-soname,libvixl.so -Wl,--exclude-libs,libunwind_llvm.a -flto=thin -fsplit-lto-unit -fprofile-use=toolchain/pgo-profiles/art/dex2oat_arm_arm64.profdata.2020-06-02 -Wno-backend-plugin |
去掉其中的
1 |
@out/soong/.intermediates/external/vixl/libvixl/android_arm_armv8-a_shared_com.android.art.debug/unstripped/libvixl.so.rsp |
就可以正常编译通过了。
如下的命令:
1 |
/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld -z noexecstack -EL --fix-cortex-a53-843419 --warn-shared-textrel -z now -z relro -z max-page-size=4096 --hash-style=gnu --enable-new-dtags --eh-frame-hdr -m aarch64linux -shared -o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_shared_com.android.art.debug/unstripped/libvixl.so -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/aarch64 -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/../lib64 -L/home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/../lib -L/lib -L/usr/lib -plugin /home/ubuntu/aosp/prebuilts/clang/host/linux-x86/clang-r383902b/bin/../lib64/LLVMgold.so -plugin-opt=mcpu=generic -plugin-opt=thinlto -plugin-opt=cs-profile-path=toolchain/pgo-profiles/art/dex2oat_arm_arm64.profdata.2020-06-02 out/soong/.intermediates/bionic/libc/crtbegin_so/android_arm64_armv8-a_com.android.art.debug/crtbegin_so.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/code-buffer-vixl.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/compiler-intrinsics-vixl.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/cpu-features.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/utils-vixl.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/assembler-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/cpu-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/cpu-features-auditor-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/decoder-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/disasm-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/instructions-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/instrument-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/logic-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/macro-assembler-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/operands-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/pointer-auth-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/simulator-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/assembler-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/constants-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/disasm-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/instructions-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/location-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/macro-assembler-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/operands-aarch32.o out/soong/.intermediates/external/libcxxabi/libc++demangle/android_arm64_armv8-a_static_lto-thin_com.android.art.debug/libc++demangle.a prebuilts/clang/host/linux-x86/clang-r383902b/lib64/clang/11.0.2/lib/linux/libclang_rt.builtins-aarch64-android.a prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/lib64/libatomic.a out/soong/.intermediates/external/libcxx/libc++/android_arm64_armv8-a_shared_com.android.art.debug/libc++.so out/soong/.intermediates/bionic/libc/libc/android_arm64_armv8-a_shared_10000/libc.so out/soong/.intermediates/bionic/libm/libm/android_arm64_armv8-a_shared_10000/libm.so out/soong/.intermediates/bionic/libdl/libdl/android_arm64_armv8-a_shared_10000/libdl.so out/soong/.intermediates/bionic/libc/crtend_so/android_arm64_armv8-a_com.android.art.debug/obj/bionic/libc/arch-common/bionic/crtend_so.o -z noexecstack -z relro -z now --build-id=md5 --warn-shared-textrel --fatal-warnings --no-undefined-version --exclude-libs libgcc.a --exclude-libs libgcc_stripped.a --exclude-libs libunwind_llvm.a --pack-dyn-relocs=android+relr --use-android-relr-tags --no-undefined --hash-style=gnu -z separate-code --icf=safe -z max-page-size=4096 --exclude-libs=libclang_rt.builtins-aarch64-android.a --gc-sections -soname libvixl.so |
同理,去掉全部的静态库链接如下:
1 |
out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/code-buffer-vixl.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/compiler-intrinsics-vixl.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/cpu-features.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/utils-vixl.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/assembler-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/cpu-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/cpu-features-auditor-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/decoder-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/disasm-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/instructions-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/instrument-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/logic-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/macro-assembler-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/operands-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/pointer-auth-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch64/simulator-aarch64.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/assembler-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/constants-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/disasm-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/instructions-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/location-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/macro-assembler-aarch32.o out/soong/.intermediates/external/vixl/libvixl/android_arm64_armv8-a_static_com.android.art.debug/obj/external/vixl/src/aarch32/operands-aarch32.o |
也可以编译通过,经过不断排查,发现这个是由于 llvm-toolchins 的 BUG 导致的,Android 11 默认使用 llvm-toochains 11.0.5 版本构建。
构建工具版本可以通过如下命令查看:
1 |
$ ls prebuilts/clang/host/linux-x86/clang-r416183b1/lib64/clang |
llvm-toochains 11.0.5 版本存在卡住的问题,具体原因暂时没有找到相关的修改记录。
一个可能的解释来自 chromium 的构建脚本 build.py,关键部分的解释截图如下:
当版本升级到 llvm-toochains 12.0 以上版本之后,此问题可以解决。
因此编译低版本的代码的时候,可能需要手工升级构建工具版本,部分编译报错需要自行调整。
如何进行相关的调整,可以参考如下的官方文档
运行镜像
选择 system-qemu.img 和 vendor-qemu.img,这两个镜像是专门为 qemu 运行制作的,如果选择 system.img 和 vendor.img,则 avd 运行失败。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ cd ~/aosp $ export ANDROID_BUILD_TOP=~/aosp $ export PATH=$PATH:$ANDROID_BUILD_TOP/out/host/linux-x86/bin $ export ANDROID_SWT=$ANDROID_BUILD_TOP/out/host/linux-x86/framework $ export ANDROID_PRODUCT_OUT=$ANDROID_BUILD_TOP/out/target/product/emulator_arm64 $ export OUT=$ANDROID_PRODUCT_OUT $ ./emu/emulator -verbose -show-kernel |
上面运行起来的镜像是从 ~/aosp/out/target/product/emulator_arm64/hardware-qemu.ini
读取配置信息的,但是这个文件直接修改无效。我们如果需要修改参数,只能从启动参数中设置。
比如我们如果需要增大内存,开启 GPU
的支持,则执行如下命令:
1 |
$ ./emu/emulator -gpu on -memory 4096 -verbose -show-kernel |
参考链接
- macOS Big Sur(11.7.5)编译Android 12.0源码过程总结
- ubuntu 20.04编译Android 11源代码&模拟器
- macOS Big Sur 编译Android11.0源码过程总结
- 代号、标记和 build 号
- AOSP 编译Android12源码全记录
- Android 开发者代码实验室
- macOS Sierra (10.12.3)上编译ARM版本Android 5.1.1_r38 (Lollipop)源代码
- How can I download and install macOS 10.12 SDK?
- Fix depends on disabled module "libbit_field_derive" error when building.
- 搭建编译环境
- [android-building] Platform development on MacOS isn't supported as of June 22, 2021.
- Can I download AOSP and compile the Android OS on a MacBook or other macOS device?
- Platform development on MacOS isn't supported as of June 22, 2021.
- Building Android 11 for x86 with ARM compatibility
- 使用VsCode调试Android Framework C/C++源代码
- How to build AOSP on M1
- Error in compiling android (12) aosp on mac 13.3 m1 max
- Intel/Apple Silicon架构MacOS平台编译AOSP源码
- 在Mac平台使用Docker搭建AOSP(Android源代码)编译环境
- ubuntu 22.04.2编译Android 12.1源代码&模拟器
- 五、Docker 数据持久化存储与性能调优
- 如何提高 Docker 在 Mac 下的文件读写速度?
- 如何提升Docker for Mac性能
- docker性能分析命令 docker 磁盘性能 转载
- Speed boost achievement unlocked on Docker Desktop 4.6 for Mac
- File system performance improvements #1592
- Docker volumes 挂载时 cached 和 delegated 的区别和选择
- Docker 优化之 Docker-sync 解决 Docker 挂载缓慢
- Enabling aarch64 as a host architecture for Android Build (WIP)
- Re: [android-building] AOSP on aws a1 instance (arm)
- [Docker Desktop for Mac] - Support for running x86-64 binaries with Rosetta 2
- M1 和 Docker 谈了个恋爱
- Using Rosetta in a UTM Linux VM with Docker on Apple Silicon
- Running Intel Binaries in Linux VMs with Rosetta
- WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8)
- Docker多架构支持-buildx构建多架构镜像
- Liviable now shares folders in Linux VMs, and should support Rosetta 2
- Running Intel Binaries in Linux VMs with Rosetta
- Rosetta in Docker
- macOS-Linux-VM-with-Rosetta
- 利用 Lima 在 M1 執行 x86 的 Ubuntu
- Compare Podman Desktop vs lima and see what are their differences.
- UTM:开源的多面手 macOS 虚拟机(更新到 2023.8.20)
- WSL Ubuntu 20.04下Android源码编译与导入Android Studio
- WSL进行aosp下载编译
- UTM:开源的多面手 macOS 虚拟机(更新到 2023.8.20)
- ubuntu server硬盘扩容(LVM)
- Build sandboxing disabled due to docker
- "Build sandboxing disabled due to nsjail error. This may become fatal in the future."
- google/nsjail
- Intel-on-ARM and ARM-on-Intel
- Intel/Apple Silicon架构MacOS平台编译AOSP源码
- MacOSX 11.6 下编译 AOSP android11 系统源代码
- FAILED: out/target/product/generic_arm64/obj/PACKAGING/vndk_intermediates/check-list-timestamp
- android-emulator-m1-preview
- 模拟器版本说明
- repo sync出现contains uncommitted changes错误解决办法
- boringssl_self_test_apex64 error, endless boot loop, emulator screen stuck on "Connecting to the Emulator"
- AVD (API 31) black screen
- Android-11 build for Raspberry Pi4
- arpi 11 : framework patch
- Build faild #71
- Android Emulator MacOS Development
- [android-kernel环境搭建]emulator_kernel
- AOSP sepolicy_tests_intermediates/sepolicy_tests error on building using MAC Catalina
- android/prebuilts/qemu-kernel
- make public aosp 11/10 build and run on M1
- Rosetta results with error for any AMD64 binary #5567
- Linux 使用strace命令查找进程卡死原因
- 内核futex的BUG导致程序hang死问题排查
- How to Install the Latest Mainline Linux Kernel Version in Ubuntu [GUI and Terminal Methods]
- Android Clang/LLVM Toolchain
- Android Clang/LLVM Prebuilts
- Android8.1源码编译问题集锦
- Source build Error Help #355
- Android dex2oat build:ERROR: Dex2oat failed to compile a boot image
- Compiling a deodexed AOSP?
- How to debug a futex contention shown in strace?
- ubuntu内核编译、安装
- 内核函数输出怎么看到_内核futex的BUG导致程序hang死问题排查
- 用M1的新MacBook兼容性到底如何?这可能是最详细的兼容性测试
- Does It ARM?
- 【连载1/2】谈谈BT二进制转译技术 - 跨指令集平台互操作的兼容性和局限性
- QEMU User Mode 二进制翻译系统原理分析及使用方法
- Kernel Support for miscellaneous Binary Formats (binfmt_misc)
- 配置 ART
使用utm ubuntu arm64的虚拟机按照步骤编译碰到下面的问题了,大佬有碰到吗
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fffff0423b9, pid=1499792, tid=1499795
#
# JRE version: OpenJDK Runtime Environment (11.0.4) (build 11.0.4+0-6508549)
# Java VM: OpenJDK 64-Bit Server VM (11.0.4+0-6508549, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xa423b9] MethodMatcher::matches(methodHandle const&) const+0x39
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/king/mikrom12_gitlab/core.1499792)
#
# An error report file with more information is saved as:
# /home/king/mikrom12_gitlab/hs_err_pid1499792.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
#
# -XX:OnError="cat hs_err_pid%p.log"
# Executing /bin/sh -c "cat hs_err_pid1499792.log" ...
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fffff0423b9, pid=1499792, tid=1499795
#
# JRE version: OpenJDK Runtime Environment (11.0.4) (build 11.0.4+0-6508549)
# Java VM: OpenJDK 64-Bit Server VM (11.0.4+0-6508549, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xa423b9] MethodMatcher::matches(methodHandle const&) const+0x39