AOSP 13编译失败:blueprint/pathtools测试报错求助
编译AOSP 13时Blueprint Pathtools测试失败的问题解决
问题描述
使用16GB内存、12代酷睿i7的x64笔记本编译AOSP 13,已通过repo sync同步源码无报错,执行source build/envsetup.sh、lunch 47、m后,编译初期出现Blueprint Pathtools的TestGlobEscapes测试失败,多次执行repo sync和m clean无效。
错误日志
root@User:/home/user/android13# source build/envsetup.sh root@User:/home/user/android13# lunch 47 root@User:/home/user/android13# m 16:10:32 ************************************************************ 16:10:32 You are building on a machine with 15.3GB of RAM 16:10:32 16:10:32 The minimum required amount of free memory is around 16GB, 16:10:32 and even with that, some configurations may not work. 16:10:32 16:10:32 If you run into segfaults or other errors, try reducing your 16:10:32 -j value. 16:10:32 ************************************************************ 16:10:32 Build sandboxing disabled due to nsjail error. build/make/core/soong_config.mk:209: warning: BOARD_PLAT_PUBLIC_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS instead. build/make/core/soong_config.mk:210: warning: BOARD_PLAT_PRIVATE_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS instead. ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=13 TARGET_PRODUCT=aosp_x86_64 TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_ARCH=x86_64 TARGET_ARCH_VARIANT=x86_64 TARGET_2ND_ARCH=x86 TARGET_2ND_ARCH_VARIANT=x86_64 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-6.2.0-34-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=TQ3C.230805.001.B2 OUT_DIR=out PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera ============================================ [ 1% 3/195] test github.com/google/blueprint/pathtools FAILED: out/host/linux-x86/bin/go/blueprint-pathtools/test/test.passed out/host/linux-x86/bin/gotestrunner -p build/blueprint/pathtools -f out/host/linux-x86/bin/go/blueprint-pathtools/test/test.passed -- out/host/linux-x86/bin/go/blueprint-pathtools/test/test -test.short --- FAIL: TestGlobEscapes (0.00s) --- FAIL: TestGlobEscapes/**/* (0.00s) glob_test.go:571: incorrect matches list: glob_test.go:571: pattern: "**/*" glob_test.go:571: got: []string{"a/", "b", "a/a"} glob_test.go:571: expected: []string{"*", "**/", "?", "a/", "b", "**/*", "**/a", "**/b/", "**/b/b", "a/a"} glob_test.go:571: incorrect deps list: glob_test.go:571: pattern: "**/*" glob_test.go:571: got: []string{".", "a"} glob_test.go:571: expected: []string{".", "**", "**/b", "a"} --- FAIL: TestGlobEscapes/**/\* (0.00s) glob_test.go:571: incorrect matches list: glob_test.go:571: pattern: "**/\\*" glob_test.go:571: got: []string(nil) glob_test.go:571: expected: []string{"*", "**/*"} glob_test.go:571: incorrect deps list: glob_test.go:571: pattern: "**/\\*" glob_test.go:571: got: []string{".", "a"} glob_test.go:571: expected: []string{".", "**", "**/b", "a"} --- FAIL: TestGlobEscapes/\*\*/**/* (0.00s) glob_test.go:571: incorrect matches list: glob_test.go:571: pattern: "\\*\\*/**/*" glob_test.go:571: got: []string(nil) glob_test.go:571: expected: []string{"**/*", "**/a", "**/b/"} glob_test.go:571: incorrect deps list: glob_test.go:571: pattern: "\\*\\*/**/*" glob_test.go:571: got: []string{"."} glob_test.go:571: expected: []string{".", "**"} --- FAIL: TestGlobEscapes/\*\*/**/* (0.00s) glob_test.go:571: incorrect matches list: glob_test.go:571: pattern: "\\*\\*/**/*" glob_test.go:571: got: []string(nil) glob_test.go:571: expected: []string{"**/*", "**/a", "**/b/", "**/b/b"} glob_test.go:571: incorrect deps list: glob_test.go:571: pattern: "\\*\\*/**/*" glob_test.go:571: got: []string{"."} glob_test.go:571: expected: []string{".", "**", "**/b"} FAIL 16:10:32 soong bootstrap failed with: exit status 1 #### failed to build some targets (1 seconds) ####
解决办法
1. 调整字符集环境变量
字符集配置可能影响glob模式匹配行为,执行以下命令后重新编译:
export LC_ALL=C m
2. 降低编译并行数
系统提示可用内存接近最低要求,减少并行编译任务数避免内存不足导致的异常:
m -j4
(可根据实际内存情况调整-j后的数字,比如-j2、-j4)
3. 删除Blueprint测试缓存
清理已生成的测试文件,重新触发测试编译:
rm -rf out/host/linux-x86/bin/go/blueprint-pathtools/test/ m
4. 临时跳过Blueprint测试(仅应急使用)
修改build/blueprint/pathtools/Android.bp文件,注释掉测试相关的模块定义后重新编译。此方法可能影响后续依赖该工具的编译环节,仅建议在其他方法无效时尝试。
内容的提问来源于stack exchange,提问作者Mehran Alidoost Nia
相关产品推荐
相关产品推荐

