kivy / buildozer

Generic Python packager for Android and iOS
https://buildozer.readthedocs.io
MIT License
1.75k stars 503 forks source link

Buildozer does not package sdl2 properly when sourcing locally #1843

Open CaptainCrusher opened 3 months ago

CaptainCrusher commented 3 months ago

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/bootstrapbuilds/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.

CaptainCrusher commented 3 months ago

My terminal command is:

buildozer android debug deploy run

CaptainCrusher commented 3 months ago

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.