2

When compiling Android Automotive OS on Arch Linux using this guide you might get an error like this on the last stage of compiling:

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 "device/generic/goldfish/tools/mk_combined_img.py", line 48
    print "'%s' cannot be converted to int" % (line[2])
          ^
SyntaxError: invalid syntax
Baby Yoda
  • 119
  • 5

1 Answers1

8

If you are getting this error when compiling AOSP on Arch linux, you need to go to the file /android/device/generic/goldfish/tools/mk_combined_img.py and change the first line: #!/usr/bin/python to #!/usr/bin/python2

It should compile fine now...

Baby Yoda
  • 119
  • 5
  • Arch Linux is rolling release distro, you can get your AOSP build failing after any system update. I personally had that pain many times. This is why I switched to building AOSP in docker containers, for example https://android.googlesource.com/platform/build/+/master/tools/docker. Also see this answer: https://stackoverflow.com/a/63173329/1028256 – Mixaz Oct 07 '20 at 19:11
  • I personally dislike things like docker containers and snap packages as they have slightly more overhead and a bit more tedious to configure/delete etc – Baby Yoda Oct 08 '20 at 13:37