kali编译AOSP报错(SyntaxError: Missing parentheses in call to ‘print‘. Did you mean print(...)? )

SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(…)?

今天下午刚解决完上一个问题后,下一个问题在编译了一个半小时后又冒了出来

image-20241004183344275

wildcard(out/target/product/generic_x86_64/clean_steps.mk) was changed, regenerating...
[ 99% 11909/11910] Create system-qemu.img now
FAILED: out/target/product/generic_x86_64/system-qemu.img
/bin/bash -c "(export SGDISK=out/host/linux-x86/bin/sgdisk SIMG2IMG=out/host/linux-x86/bin/simg2img;      device/generic/goldfish/tools/mk_combined_img.py -i out/target/product/generic_x86_64/system-qemu-config.txt -o out/target/product/generic_x86_64/system-qemu.img)"
  File "/home/kali/aosp/device/generic/goldfish/tools/mk_combined_img.py", line 53
    print "Invalid partition number: %d, range [1..%d]" % \
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
[100% 11910/11910] build check-all-partition-sizes
The sum of sizes of [system vendor] is within BOARD_SUPER_PARTITION_SIZE:
1468014592+119820288 == 1587834880 <=  3229614080 == 3229614080
The sum of sizes of [system vendor] is within BOARD_EMULATOR_DYNAMIC_PARTITIONS_SIZE:
1468014592+119820288 == 1587834880 <= 3221225472 == 3221225472
The sum of sizes of [emulator_dynamic_partitions] is within BOARD_SUPER_PARTITION_SIZE:
3221225472 == 3221225472 <= 3229614080 == 3229614080
05:53:59 ninja failed with: exit status 1

#### failed to build some targets (08:34 (mm:ss)) ####

你的错误的具体位置可能不一样,但核心问题都是SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?,同样在网上查了一下,发现是python版本的问题

这个应该用python2,而不是python3

解决方案:

如果操作系统没有安装python2,那就安装python2(不过linux系统一般会预装python2)

然后修改报错对应的python文件:

sudo vim ~/aosp/device/generic/goldfish/tools/mk_combined_img.py

在图中所示位置:
image-20241004183730687

把第一行的python改成python2即可

结果:

image-20241004183805347

终于编译成功了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

哪个编程语言更好

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值