kivy/buildozer

Buildozer does not package sdl2 properly when sourcing locally

Closed this issue · 3 comments

When trying to package sdl2 from local files using requirements.source in the buildozer.spec file, buildozer does not package them properly.

sdl2 has a lot of seperate libraries which all need to be in the same folder (named jni). But for each library it tries to add, buildozer deletes the entire folder and creates a new one with the library in it. This deletes all the libraries that were previously in that folder. So when buildozer tries to access them, I get a file not found error.

Here's the important part of the terminal log:

[INFO]: Unpacking sdl2_image for arm64-v8a
[INFO]: P4A_sdl2_image_DIR exists, symlinking instead
[DEBUG]: Remove directory and subdirectory /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni
[DEBUG]: Create directory /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni
[DEBUG]: -> running cp -a /home/chris/buildozer_dependencies/sdl2_image /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni/SDL2_image
[INFO]: Unpacking sdl2_mixer for arm64-v8a
[INFO]: P4A_sdl2_mixer_DIR exists, symlinking instead
[DEBUG]: Remove directory and subdirectory /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni
[DEBUG]: Create directory /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni
[DEBUG]: -> running cp -a /home/chris/buildozer_dependencies/sdl2_mixer /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni/SDL2_mixer
[INFO]: Unpacking sdl2_ttf for arm64-v8a
[INFO]: P4A_sdl2_ttf_DIR exists, symlinking instead
[DEBUG]: Remove directory and subdirectory /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni
[DEBUG]: Create directory /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni
[DEBUG]: -> running cp -a /home/chris/buildozer_dependencies/sdl2_ttf /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni/SDL2_ttf
[INFO]: Unpacking sdl2 for arm64-v8a
[INFO]: P4A_sdl2_DIR exists, symlinking instead
[DEBUG]: Remove directory and subdirectory /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni (emphasis mine)
[DEBUG]: Create directory /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni
[DEBUG]: -> running cp -a /home/chris/buildozer_dependencies/sdl2 /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni/SDL

Later on:
[INFO]: Prebuilding sdl2_image for arm64-v8a
[INFO]: -> directory context /home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni/SDL2_image/external

FileNotFoundError: [Errno 2] No such file or directory: '/home/chris/MyPython/prj/Anagrams/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni/SDL2_image/external'

When I check the jni folder, it only has SDL in it.

There is no such error when sourcing from the internet.

My terminal command is:

buildozer android debug deploy run

I made some modifications to python-for-android, and its working for me now. I am not going to submit a pr because my patch is sketchy.

👋 @CaptainCrusher,
Sorry to hear you are having difficulties with Kivy's Buildozer; Kivy unites a number of different technologies, so building apps can be temperamental.
We try to use GitHub issues only to track work for developers to do to fix bugs and add new features to Buildozer. This issue has been closed, because it doesn't describe a bug or new feature request for Buildozer.
There is a mailing list and a Discord channel to support Kivy users debugging their own systems, which should be able to help. They are linked in the ReadMe.
Of course, if it turns out you have stumbled over a bug in Buildozer, we do want to hear about it here. The support channels should be able to help you craft an appropriate bug report.