1、问题:
/vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal File "vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal File "/vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal File "vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal File "vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal rm: 无法删除 'rawprogram0_FFBM.xml.bak': 没有那个文件或目录 rm: 无法删除 'rawprogram0_FFBM_gpiotest.xml.bak': 没有那个文件或目录 rm: 无法删除 'rawprogram0.xml.bak': 没有那个文件或目录 [PKG_WARN] 分包未产出任何 super_.img,改用 /usr/bin/python 直接执行 checksparse.py 兜底 File "vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal File "vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal File "vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal File "vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal File "/vendor/vendorcode/build/sparseimage/checksparse.py", line 120 length = (1L * blocks) * blk_sz ^ SyntaxError: invalid decimal literal [PKG_FAIL] 分包仍未生成任何 super_.img,中止(避免版本包沿用旧分片) 排查:1) /usr/bin/python 是否为 python2(checksparse.py 为 py2 脚本) 2) vendor/vendorcode/build/sparseimage/super.img 是否存在且完整
解答
原因在于厂商提供的分包工具 checksparse.py 是一个 Python 2 脚本,其中包含了 1L 这种 Python 2 特有的长整型字面量语法。您的 Ubuntu 宿主机上未安装 python2 环境,导致脚本的 PYSPLIT 变量按回退逻辑使用了系统的 /usr/bin/python(实际指向了 Python 3)。Python 3 不支持 1L 语法,因此抛出了 SyntaxError: invalid decimal literal
在终端执行以下命令安装 Python 2:
sudo apt-get update
sudo apt-get install python2
然后执行脚本
2、问题
报错如下:
开始 Thu Sep 10 10:01:28 AM UTC 2026 =====
[CPU] class=low cores=8 load=0.21 other_builders=0 jobs=6
CMD=all JOBS=6 SKIP_QSSI=0 SKIP_PREPARE=0 NO_SUPER=0 KERNEL_OUT= VARIANT=userdebug FRESH=0
===== [1/4] QSSI: qssi_64-userdebug (文档 5.1~5.4)=====
including vendor/qcom/opensource/core-utils/vendorsetup.sh
including vendor/qcom/proprietary/common/vendorsetup.sh
grep: /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/device/qcom//.mk: No such file or directory
including vendor/qcom/proprietary/prebuilt_HY11/vendorsetup.sh
Created 0 symlinks out of 78 mapped links..
Release not specified, defaulting to bp2a build
/mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/build/blueprint/microfactory/microfactory.bash: line 63: cd: /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/prebuilts/go/linux-arm64/: No such file or directory
/mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/build/blueprint/microfactory/microfactory.bash: line 63: /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/prebuilts/go/linux-arm64//bin/go: No such file or directory
Non QSSI mapped target. If this not a nonqssi_legacy_build, the target must be added to the TARGET_PRODUCT_MAPPING lists
============================================
build.sh: Dist not (yet) enabled for
============================================
build.sh: line 898: : command not found
build.sh: line 899: : command not found
============================================
build.sh: is not a QSSI target. Using legacy build process for compilation...
============================================
============================================
============================================
including vendor/qcom/opensource/core-utils/vendorsetup.sh
including vendor/qcom/proprietary/common/vendorsetup.sh
grep: /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/device/qcom//.mk: No such file or directory
including vendor/qcom/proprietary/prebuilt_HY11/vendorsetup.sh
Created 0 symlinks out of 78 mapped links..
real 0m2.152s
user 0m0.271s
sys 0m0.153s
============================================
============================================
Traceback (most recent call last):
File "/mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/vendor/qcom/opensource/core-utils/build/makefile-violation-scanner.py", line 40, in
ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP') + '/'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
real 0m0.052s
user 0m0.023s
sys 0m0.017s
============================================
build.sh: FAILED: python -B /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/vendor/qcom/opensource/core-utils/build/makefile-violation-scanner.py
============================================
[修复] QSSI 首次编译失败(rc=1),疑似 API 快照不一致,执行 m update-api 后重试
/mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/build/blueprint/microfactory/microfactory.bash: line 63: cd: /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/prebuilts/go/linux-arm64/: No such file or directory
/mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/build/blueprint/microfactory/microfactory.bash: line 63: /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/prebuilts/go/linux-arm64//bin/go: No such file or directory
failed to build some targets
Non QSSI mapped target. If this not a nonqssi_legacy_build, the target must be added to the TARGET_PRODUCT_MAPPING lists
============================================
build.sh: Dist not (yet) enabled for
============================================
build.sh: line 898: : command not found
build.sh: line 899: : command not found
============================================
build.sh: is not a QSSI target. Using legacy build process for compilation...
============================================
============================================
============================================
including vendor/qcom/opensource/core-utils/vendorsetup.sh
including vendor/qcom/proprietary/common/vendorsetup.sh
grep: /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/device/qcom//.mk: No such file or directory
including vendor/qcom/proprietary/prebuilt_HY11/vendorsetup.sh
Created 0 symlinks out of 78 mapped links..
real 0m2.269s
user 0m0.268s
sys 0m0.161s
============================================
============================================
Traceback (most recent call last):
File "/mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/vendor/qcom/opensource/core-utils/build/makefile-violation-scanner.py", line 40, in
ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP') + '/'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
real 0m0.046s
user 0m0.029s
sys 0m0.005s
============================================
build.sh: FAILED: python -B /mnt/aosp_ssd/android/LA.QSSI.16.0_juwei/vendor/qcom/opensource/core-utils/build/makefile-violation-scanner.py
============================================
[MAKE_FAIL] QSSI 编译失败 rc=1
解答:
报错的核心原因在于源码同步不完整导致编译环境初始化(lunch)失败,进而引发全局环境变量缺失与后续编译脚本的崩溃。
错误根因分析
- 基础工具链缺失: 日志中多次出现
/prebuilts/go/linux-arm64/: No such file or directory。该目录包含 Android 构建系统 (Soong/Blueprint) 所需的 Go 编译器。预编译库缺失导致环境初始化被意外阻断。 - 环境变量未生成: 由于
lunch qssi_64-userdebug在底层静默失败,系统未能正确导出ANDROID_BUILD_TOP和目标机型等关键环境变量。日志中出现的[build.sh]: Dist not (yet) enabled for(目标名为空)即证明了这一点。 - Python 脚本引发崩溃: 由于
ANDROID_BUILD_TOP环境变量未生效,当build.sh脚本调用makefile-violation-scanner.py时,os.environ.get获取到了None,最终引发了TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'的致命错误。
解决方案
- 重新同步代码仓: 请重点检查
prebuilts/文件夹。需要联系代码提供方或使用repo sync -c --force-sync重新同步代码,确保prebuilts/go/linux-arm64/目录完整存在。 - 手动验证环境配置: 在重新运行一键脚本前,建议先进入 QSSI 目录手动验证。输入指令配置编译环境
source build/envsetup.sh。 - 验证 Lunch 状态: 使用指令选择编译项
lunch qssi_64-userdebug。观察终端输出,必须确认成功打印出完整的 TARGET 环境变量列表(如PLATFORM_VERSION、TARGET_PRODUCT等),且不再出现No such file报错。 - 重新一键编译: 确认基础编译环境正常就绪后,清理之前的残留并进行全量编译:可使用
./make.sh clean清理构建输出目录(不用 git clean,只删 out 目录),随后执行./make.sh all全量编译:QSSI → 内核(Kleaf/Bazel) → VENDOR Android → 合并 super.img