Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymunk kivy example apk crashing on android 5.1 #194

Closed
Sahil-pixel opened this issue Dec 31, 2020 · 10 comments
Closed

pymunk kivy example apk crashing on android 5.1 #194

Sahil-pixel opened this issue Dec 31, 2020 · 10 comments

Comments

@Sahil-pixel
Copy link

Sahil-pixel commented Dec 31, 2020

I have build apk kivy example code but it is crashing ...runtime log shown below
######buildozer requiremnts is below
##requirements = python3,kivy==2.0.0,plyer,android,pyjnius,pymunk,cffi,pycparser

I/python (15523): [INFO ] [GL ] Texture max size <4096>
I/python (15523): [INFO ] [GL ] Texture max units <8>
I/python (15523): [INFO ] [Window ] auto add sdl2 input provider
I/python (15523): [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
I/python (15523): [INFO ] [Text ] Provider: sdl2
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBNewForExtents' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBNewForCircle' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBIntersects' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBContainsBB' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBContainsVect' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBMerge' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBExpand' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBCenter' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBArea' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBMergedArea' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBSegmentQuery' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBIntersectsSegment' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): /home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/cparser.py:162: UserWarning: Global variable '_cpBBClampVect' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
I/python (15523): Loading chipmunk for Linux (32bit) [/data/data/org.test.tone/files/app/_python_bundle/site-packages/pymunk/libchipmunk.so]
I/python (15523): Failed to load Pymunk library.
I/python (15523): This error usually means that you don't have a compiled version of Chipmunk in
I/python (15523): the correct spot where Pymunk can find it. If you tried to run Pymunk without
I/python (15523): installing it properly this can be the result.
I/python (15523): The good news is that it is usually enough (at least on *nix and OS X) to
I/python (15523): run the build command:
I/python (15523): You compile Chipmunk with
I/python (15523): > python setup.py build_ext --inplace
I/python (15523): and then verify with
I/python (15523): > python -m pymunk.test
I/python (15523): (for complete instructions please see the readme file)
I/python (15523): Another cause of this problem could be if you didnt included the Chipmunk
I/python (15523): library when using a freeze tool such as Py2exe or PyInstaller. Please see the
I/python (15523): examples for how to include the library file when freezing a binary.
I/python (15523): If it still doesnt work, please report as a bug on the issue tracker at
I/python (15523): https://github.com/viblo/pymunk/issues
I/python (15523): Remember to include information about your OS, which version of python you use
I/python (15523): and the version of pymunk you tried to run. A description of what you did to
I/python (15523): trigger the error is also good. Please include the exception traceback if any
I/python (15523): (usually found below this message).
I/python (15523): Traceback (most recent call last):
I/python (15523): File "/home/sahil/app_test_kivy/.buildozer/android/app/main.py", line 33, in
I/python (15523): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/pymunk/init.py", line 58, in
I/python (15523): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/pymunk/_chipmunk_cffi.py", line 3, in
I/python (15523): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/pymunk/_chipmunk_cffi_abi.py", line 1475, in
I/python (15523): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/pymunk/_libload.py", line 50, in load_library
I/python (15523): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/api.py", line 146, in dlopen
I/python (15523): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/api.py", line 828, in _make_ffi_library
I/python (15523): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/cffi/api.py", line 823, in _load_backend_lib
I/python (15523): OSError: cannot load library '/data/data/org.test.tone/files/app/_python_bundle/site-packages/pymunk/libchipmunk.so': dlopen failed: cannot locate symbol "__sF" referenced by "libchipmunk.so".... Additionally, ctypes.util.find_library() did not manage to locate a library called '/data/data/org.test.tone/files/app/_python_bundle/site-packages/pymunk/libchipmunk.so'
I/python (15523): Python for android ended.

@Sahil-pixel Sahil-pixel changed the title c pymunk kivy example apk crashing on android 5.1 Dec 31, 2020
@viblo
Copy link
Owner

viblo commented Dec 31, 2020

Thanks for the report!
It seems like it cant find the chipmunk library file, which is a bit strange. Anyway, Im currently working on updating the python-for-android recipe for pymunk to use the newly released Pymunk 6.0.0 instead. The new version is structured in a different way and does not use a separate library file for chipmunk.

Is it possible for you to use Pymunk 6 instead? If so I have made a update recipe that would be great if you could try (it works fine on my phone).

@viblo
Copy link
Owner

viblo commented Dec 31, 2020

The updated recipe is here: https://gist.github.com/viblo/befb56e5415fc509c25f1ba0fd6c020c
This should be put in kivy_pymunk_demo/p4a-recipes/pymunk/__init__.py. By placing the init file there you override the default pymunk recipe. Note that to rebuild you will need to clean the pymunk build, otherwise it will just reuse the old one. You can do that with first p4a clean_recipe_build pymunk and then p4a clean_dists before you build the apk.

@viblo
Copy link
Owner

viblo commented Dec 31, 2020

Meanwhile Ive opened a PR to the p4a project here: kivy/python-for-android#2389
(I also noticed now that you use buildozer to build your apk and not p4a directly. In that case Im not sure if putting a manual p4a-recipes folder will work for testing, or if you need to wait until its merged into p4a.

@Sahil-pixel
Copy link
Author

Thanks for the report!
It seems like it cant find the chipmunk library file, which is a bit strange. Anyway, Im currently working on updating the python-for-android recipe for pymunk to use the newly released Pymunk 6.0.0 instead. The new version is structured in a different way and does not use a separate library file for chipmunk.

Is it possible for you to use Pymunk 6 instead? If so I have made a update recipe that would be great if you could try (it works fine on my phone).

yes I want to try ......Kivy with pymunk example code is looking great..I am interested

@Sahil-pixel
Copy link
Author

New problem with 6.0.0
@viblo
I/python ( 6471): AND: Ran string
I/python ( 6471): Run user program, change dir and execute entrypoint
I/python ( 6471): [WARNING] [Config ] Older configuration version detected (0 instead of 21)
I/python ( 6471): [WARNING] [Config ] Upgrading configuration in progress.
I/python ( 6471): [INFO ] [Logger ] Record log in /data/data/org.test.tone/files/app/.kivy/logs/kivy_21-01-01_0.txt
I/python ( 6471): [INFO ] [Kivy ] v2.0.0
I/python ( 6471): [INFO ] [Kivy ] Installed at "/data/data/org.test.tone/files/app/_python_bundle/site-packages/kivy/init.pyc"
I/python ( 6471): [INFO ] [Python ] v3.8.1 (default, Jan 1 2021, 18:48:11)
I/python ( 6471): [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
I/python ( 6471): [INFO ] [Python ] Interpreter at ""
--------- beginning of system
I/python ( 6471): [INFO ] [Factory ] 186 symbols loaded
I/python ( 6471): [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored)
I/python ( 6471): [INFO ] [Window ] Provider: sdl2
I/python ( 6471): [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
I/python ( 6471): [INFO ] [GL ] Backend used
I/python ( 6471): [INFO ] [GL ] OpenGL version <b'OpenGL ES 2.0'>
I/python ( 6471): [INFO ] [GL ] OpenGL vendor <b'ARM'>
I/python ( 6471): [INFO ] [GL ] OpenGL renderer <b'Mali-400 MP'>
I/python ( 6471): [INFO ] [GL ] OpenGL parsed version: 2, 0
I/python ( 6471): [INFO ] [GL ] Texture max size <4096>
I/python ( 6471): [INFO ] [GL ] Texture max units <8>
I/python ( 6471): [INFO ] [Window ] auto add sdl2 input provider
I/python ( 6471): [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
I/python ( 6471): [INFO ] [Text ] Provider: sdl2
I/python ( 6471): Traceback (most recent call last):
I/python ( 6471): File "/home/sahil/app_test_kivy/.buildozer/android/app/main.py", line 33, in
I/python ( 6471): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/pymunk/init.py", line 67, in
I/python ( 6471): File "/home/sahil/app_test_kivy/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/tone/pymunk/_chipmunk_cffi.py", line 5, in
I/python ( 6471): ImportError: dlopen failed: cannot locate symbol "fmod" referenced by "_chipmunk.so"...
I/python ( 6471): Python for android ended.

@Sahil-pixel
Copy link
Author

okkk . i have tested on Android 8.0 it is working well pymunk 6.0.0 .but crashing in ANDROID 5.1 see above runtime log for Android 5.1

@viblo
Copy link
Owner

viblo commented Jan 1, 2021

Ah I see. I will have to test a bit more. Hopefully its enough to add a link to math.
I updated the gist with the possible fix:
https://gist.github.com/viblo/befb56e5415fc509c25f1ba0fd6c020c
(So far I havent tested myself on Android 5.1, I dont have the emulator here, but will try to set it up and run some tests myself)

@viblo
Copy link
Owner

viblo commented Jan 3, 2021

I managed to do some testing in the emulator, but only on x86 arch and there it seems to work now. I opened a PR in the Python for android project here: kivy/python-for-android#2399
But would still be great if you could test and verify that it actually fix your problem.

@Sahil-pixel
Copy link
Author

Great.. Now this is working in Android 5.1

@viblo
Copy link
Owner

viblo commented Jan 4, 2021

Great!

@viblo viblo closed this as completed Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants