python-for-android icon indicating copy to clipboard operation
python-for-android copied to clipboard

Update Dockerfile for ARM

Open rbebb opened this issue 2 years ago • 2 comments

Checklist

  • [x] the issue is indeed a bug and not a support request
  • [x] issue doesn't already exist: https://github.com/kivy/python-for-android/issues
  • [x] I have a short, runnable example that reproduces the issue
  • [x] I reproduced the problem with the latest development version (p4a.branch = develop)
  • [x] I used the grave accent (aka backticks) to format code or logs when appropriated

Versions

  • Python: Default
  • OS: macOS Monterey (12.5) on Apple Silicon (M1)
  • Kivy: Default
  • Cython: Default
  • OpenJDK: Default

Description

Docker builds an x86 image instead of an ARM image. The Dockerfile just needs to be updated to remove references to i386 (x86). I found this out after using the P4A image as the base for another image on an M1 machine running macOS Monterey.

buildozer.spec

N/A

Logs

The following occurs after running a Docker image with the P4A image as the base image:

WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

rbebb avatar Aug 08 '22 19:08 rbebb

Can this arm based image build a p4a distribution and apk on osx ? As p4a depends on the google sdk/ndk, and i don’t know if they have working arm versions.

tshirtman avatar Aug 09 '22 11:08 tshirtman

@tshirtman The x86 Docker image can build a p4a distribution and an apk using macOS on Apple Silicon, but a modified Docker image for ARM cannot (even though a modified Docker image for ARM can build). It looks like Android's SDKs and NDK ≥ 24 (https://github.com/android/ndk/issues/1299#issuecomment-1026338583) support Apple Silicon.

rbebb avatar Aug 09 '22 13:08 rbebb

Apparently, the Android NDK is not supported on an ARM Linux Host (in my case, that'd be in the Docker container). I filed an issue on the NDK repo to see if they can add support for that: https://github.com/android/ndk/issues/1752

rbebb avatar Aug 19 '22 17:08 rbebb

Hi @rbebb !

Yeah, unfortunately, Google doesn't provide an ARM Linux compatible NDK, and it looks like that is not going to happen anytime soon. (For this reason, python-for-android is incompatible also on Raspberry Pi).

I guess we can only mark this issue as "Not planned", but not due to our fault.

BTW, I've submitted a PR (and waiting for the CI to complete before the merge) that forces docker to build (and run) a linux/amd64 image also on Apple Silicon macs, even if it's not the default. The performance may not be the same as a linux/arm64, but at least it works.

See: https://github.com/kivy/python-for-android/pull/2660

misl6 avatar Aug 23 '22 08:08 misl6