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

ImportError when the apk launches with SDL2 bootstrap, kivy and python3crystax #658

Closed
haricot opened this issue Mar 2, 2016 · 16 comments
Closed

Comments

@haricot
Copy link

haricot commented Mar 2, 2016

I do not know if it actually works, but in my case it does not work with android 5.0. And I'd like to know why :-) (the apk works well with sdl2, Kivy, python 2)

...
I/python  ( 9904): Android kivy bootstrap done. __name__ is __main__
I/python  ( 9904): AND: Ran string
I/python  ( 9904): Run user program, change dir and execute entrypoint
I/python  ( 9904): main.py
I/python  ( 9904): [WARNING           ] [Config      ] Older configuration version detected (0 instead of 14)
I/python  ( 9904): [WARNING           ] [Config      ] Upgrading configuration in progress.
I/python  ( 9904): [INFO              ] [Logger      ] Record log in /data/data/org.hello.world/files/.kivy/logs/kivy_16-03-02_0.txt
I/python  ( 9904): [INFO              ] [Kivy        ] v1.9.2-dev0
I/python  ( 9904): [INFO              ] [Python      ] v3.5.0 (default, Dec 24 2015, 05:56:40) 
I/python  ( 9904): [GCC 5.3 20151204]
I/python  ( 9904):  Traceback (most recent call last):
I/python  ( 9904):    File "main.py", line 13, in <module>
I/python  ( 9904):      from kivy.app import App
I/python  ( 9904):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/app.py", line 319, in <module>
I/python  ( 9904):      from kivy.base import runTouchApp, stopTouchApp
I/python  ( 9904):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/base.py", line 30, in <module>
I/python  ( 9904):      from kivy.event import EventDispatcher
I/python  ( 9904):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/event.py", line 8, in <module>
I/python  ( 9904):      import kivy._event
I/python  ( 9904):  ImportError: dlopen failed: cannot locate symbol "PyErr_GivenExceptionMatches" referenced by "_event.so"...
I/python  ( 9904): Python for android ended.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@haricot
Copy link
Author

haricot commented Mar 3, 2016

Maybe it's a bug
python3.5 https://bugs.python.org/issue12029
python3.6 https://bugs.python.org/issue25537

Can we apply a patch python3crystax?

@inclement
Copy link
Member

I'm not sure what's wrong here - it could maybe be the bug in python, but I know the python3 with crystax can work and the error isn't with any custom code which I haven't tested.

There's currently a bug with python3crystax and kivy that could maybe manifest this way, involving being compiled with the wrong python. Could you try building with kivy 1.9.1 (not the master branch, as is the default) - I think you should be able to use 'kivy==1.9.1' in the requirements, though you'll also need to make sure everything is rebuilt (you can do p4a clean_all first to be sure)?

@haricot
Copy link
Author

haricot commented Mar 3, 2016

Thank you for your answers.
I follow your instructions but I get the same result.

...
I/python  ( 9743): Android kivy bootstrap done. __name__ is __main__
I/python  ( 9743): AND: Ran string
I/python  ( 9743): Run user program, change dir and execute entrypoint
I/python  ( 9743): main.py
I/python  ( 9743): [WARNING           ] [Config      ] Older configuration version detected (0 instead of 14)
I/python  ( 9743): [WARNING           ] [Config      ] Upgrading configuration in progress.
I/python  ( 9743): [INFO              ] [Logger      ] Record log in /data/data/org.hello.world/files/.kivy/logs/kivy_16-03-04_0.txt
I/python  ( 9743): [INFO              ] [Kivy        ] v1.9.1
I/python  ( 9743): [INFO              ] [Python      ] v3.5.0 (default, Dec 24 2015, 05:56:06) 
I/python  ( 9743): [GCC 5.3 20151204]
I/python  ( 9743):  Traceback (most recent call last):
I/python  ( 9743):    File "main.py", line 1, in <module>
I/python  ( 9743):      from kivy.app import App
I/python  ( 9743):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/app.py", line 319, in <module>
I/python  ( 9743):      from kivy.base import runTouchApp, stopTouchApp
I/python  ( 9743):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/base.py", line 30, in <module>
I/python  ( 9743):      from kivy.event import EventDispatcher
I/python  ( 9743):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/event.py", line 8, in <module>
I/python  ( 9743):      import kivy._event
I/python  ( 9743):  ImportError: dlopen failed: cannot locate symbol "PyObject_GetAttr" referenced by "_event.so"...
I/python  ( 9743): Python for android ended.

@inclement
Copy link
Member

Interesting that it's a different symbol it can't find. I think maybe it more generally has failed to find/load the python3 .so file. I haven't tried the build for a while, but I'll see if I can reproduce it (it could be a few days before I have time though).

If you'd like to investigate, I'd start by checking the java bootstrap code and finding a way to check if it's loading python3.5m.so correctly. There may be a log message about this already, but I don't remember the format. If it isn't loading it, that is probably the problem.

@haricot
Copy link
Author

haricot commented Mar 4, 2016

Yes you are right, i went a little fast, this is not the same result.
With Kivy==1.9.2
cannot locate symbol "PyErr_GivenExceptionMatches"

and with kivy==1.9.1
cannot locate symbol "PyObject_GetAttr"

I looked where the files .so point with my phone root and it seemed to be the right place but I may be wrong.

@inclement
Copy link
Member

It's the libpython3.5m.so that's important - did you find that one? And even if it's there (in the libs/armeabi folder), the important question is probably if it's loaded by the java bootstrap.

@haricot
Copy link
Author

haricot commented Mar 4, 2016

I do not know if the libpython3.5m.so and finally fully charged by the bootstrap Java.

root@hlte:/data/data/org.hello.world/lib # ls
libSDL2.so
libSDL2_image.so
libSDL2_mixer.so
libSDL2_ttf.so
libcrystax.so
libmain.so
libpython3.5m.so
V/PythonUtil( 9743): Loaded everything!
V/PythonActivity( 9743): Did super onCreate
V/PythonActivity( 9743): Setting env vars for start.c and Python to use
V/PythonActivity( 9743): Access to our meta-data...
I/PythonActivity( 9743): Surface will NOT be transparent
I/python  ( 9743): Initialize Python for Android
I/python  ( 9743): Changing directory to the one provided by ANDROID_ARGUMENT
I/python  ( 9743): /data/data/org.hello.world/files
I/python  ( 9743): Preparing to initialize python
I/python  ( 9743): crystax_python exists
I/python  ( 9743): calculated paths to be...
I/python  ( 9743): /data/data/org.hello.world/files/crystax_python/stdlib.zip:/data/data/org.hello.world/files/crystax_python/modules
I/python  ( 9743): set wchar paths...
I/ActivityManager(  860): Displayed org.hello.world/org.kivy.android.PythonActivity: +2s288ms (total +44m15s972ms)
I/Timeline(  860): Timeline: Activity_windows_visible id: ActivityRecord{216ce99e u0 org.hello.world/org.kivy.android.PythonActivity t1661} time:14680474
I/python  ( 9743): Initialized python
I/python  ( 9743): AND: Init threads
I/python  ( 9743): testing python print redirection
I/python  ( 9743): Android path ['.', '/data/data/org.hello.world/files/crystax_python/stdlib.zip', '/data/data/org.hello.world/files/crystax_python/modules', '/data/data/org.hello.world/files/crystax_python/site-packages']
I/python  ( 9743): os.environ is environ({'LOOP_MOUNTPOINT': '/mnt/obb', 'ANDROID_ASSETS': '/system/app', 'ANDROID_BOOTLOGO': '1', 'PYTHONPATH': '/data/data/org.hello.world/files:/data/data/org.hello.world/files/lib', 'ANDROID_ROOT': '/system', 'MC_AUTH_TOKEN_PATH': '/efs', 'ANDROID_PROPERTY_WORKSPACE': '8,0', 'VIBE_PIPE_PATH': '/dev/pipes', 'ANDROID_PRIVATE': '/data/data/org.hello.world/files', 'KNOX_STORAGE': '/data/knox/ext_sdcard', 'ANDROID_DATA': '/data', 'EXTERNAL_STORAGE': '/storage/emulated/legacy', 'ASEC_MOUNTPOINT': '/mnt/asec', 'ANDROID_APP_PATH': '/data/data/org.hello.world/files', 'EMULATED_STORAGE_TARGET': '/storage/emulated', 'SECONDARY_STORAGE': '/storage/extSdCard', 'PYTHONHOME': '/data/data/org.hello.world/files', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'ANDROID_SOCKET_zygote': '9', 'EMULATED_STORAGE_SOURCE': '/mnt/shell/emulated', 'LD_PRELOAD': 'libsigchain.so:libNimsWrap.so', 'ANDROID_ARGUMENT': '/data/data/org.hello.world/files', 'PYTHON_NAME': 'python', 'ANDROID_STORAGE': '/storage', 'ANDROID_ENTRYPOINT': 'main.pyo', 'BOOTCLASSPATH': '/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/apache-xml.jar:/system/framework/sec_edm.jar:/system/framework/timakeystore.jar:/system/framework/seccamera.jar:/system/framework/scrollpause.jar:/system/framework/stayrotation.jar:/system/framework/smartfaceservice.jar:/system/framework/commonimsinterface.jar:/system/framework/imsmanager.jar:/system/framework/sprengine.jar:/system/framework/smartbondingservice.jar:/system/framework/secocsp.jar:/system/framework/secEmailBC.jar:/system/framework/knoxvpnuidtag.jar:/system/framework/simageis.jar:/system/framework/qcmediaplayer.jar:/system/framework/WfdCommon.jar:/system/framework/oem-services.jar:/system/framework/org.codeaurora.Performance.jar:/system/framework/vcard.jar:/system/framework/tcmiface.jar', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar'})
I/python  ( 9743): Android kivy bootstrap done. __name__ is __main__
I/python  ( 9743): AND: Ran string
I/python  ( 9743): Run user program, change dir and execute entrypoint
I/python  ( 9743): main.py
I/python  ( 9743): [WARNING           ] [Config      ] Older configuration version detected (0 instead of 14)
I/python  ( 9743): [WARNING           ] [Config      ] Upgrading configuration in progress.
I/python  ( 9743): [INFO              ] [Logger      ] Record log in /data/data/org.hello.world/files/.kivy/logs/kivy_16-03-04_0.txt
I/python  ( 9743): [INFO              ] [Kivy        ] v1.9.1
I/python  ( 9743): [INFO              ] [Python      ] v3.5.0 (default, Dec 24 2015, 05:56:06) 
I/python  ( 9743): [GCC 5.3 20151204]
I/python  ( 9743):  Traceback (most recent call last):
I/python  ( 9743):    File "main.py", line 1, in <module>
I/python  ( 9743):      from kivy.app import App
I/python  ( 9743):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/app.py", line 319, in <module>
I/python  ( 9743):      from kivy.base import runTouchApp, stopTouchApp
I/python  ( 9743):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/base.py", line 30, in <module>
I/python  ( 9743):      from kivy.event import EventDispatcher
I/python  ( 9743):    File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/event.py", line 8, in <module>
I/python  ( 9743):      import kivy._event
I/python  ( 9743):  ImportError: dlopen failed: cannot locate symbol "PyObject_GetAttr" referenced by "_event.so"...
I/python  ( 9743): Python for android ended.

@haricot haricot closed this as completed Mar 4, 2016
@haricot haricot reopened this Mar 4, 2016
@haricot
Copy link
Author

haricot commented Mar 17, 2016

$ readelf  -Ws _event.so| grep -i PyErr_GivenExceptionMatches
    11: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PyErr_GivenExceptionMatches
   684: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PyErr_GivenExceptionMatches

$ readelf  -Ws libpython3.5m.so| grep -i PyErr_GivenExceptionMatches
   507: 00047851   196 FUNC    GLOBAL DEFAULT    7 PyErr_GivenExceptionMatches

$ readelf -Ws _event.so | grep -i PyObject_GetAttr
    10: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_GetAttr
   124: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_GetAttrString
    32: 00003445    12 FUNC    LOCAL  DEFAULT    7 __Pyx_PyObject_GetAttrStr
   683: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_GetAttr
   797: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_GetAttrString

readelf -Ws libpython3.5m.so | grep -i PyObject_GetAttr
   107: 0009267d    60 FUNC    GLOBAL DEFAULT    7 PyObject_GetAttrString
   120: 000926df    26 FUNC    GLOBAL DEFAULT    7 _PyObject_GetAttrId
   309: 00092611   108 FUNC    GLOBAL DEFAULT    7 PyObject_GetAttr

Perhaps we must add a few things as below to the bootstrap sdl2 _event.so) work ?
( python-for-Android/pythonforandroid/bootstrap/sdl2/build/jni/src/start.c)
(kivy/kivy/_event.pyx ( _event.so))

#Presentation EuroPython 2012: C++ APIs on Python

#Exception translation
PyObject *t, *v, *tb;
PyErr_Fetch(&t, &v, &tb);

// Check if it's a ValueError
if (PyErr_GivenExceptionMatches(

    value_error_class_obj, t))
{
 throw ValueError();
}

If you'd like to investigate, I'd start by checking the java bootstrap code and finding a way to check if it's loading python3.5m.so correctly. There may be a log message about this already, but I don't remember the format. If it isn't loading it, that is probably the problem.

Have you a clues for to invest bootstrap sdl and libpython3.5m.so ?

@haricot
Copy link
Author

haricot commented Mar 30, 2016

it is good it works :-)
He was the llibpython3.5m.so who has not been charged

I added this to the setup.py file Kivy

      if PY3:
            e.extra_link_args += ['-lpython3.5m']

and this to the setup.py file pyjnius:

if PY3:
    extra_link_args = ['-lpython3.5m']
I/python  (31712): Initialized python
I/python  (31712): AND: Init threads
I/python  (31712): testing python print redirection
I/python  (31712): Android path ['.', '/data/data/org.hello.world/files/crystax_python/stdlib.zip', '/data/data/org.hello.world/files/crystax_python/modules', '/data/data/org.hello.world/files/crystax_python/site-packages']
I/python  (31712): os.environ is environ({'BOOTCLASSPATH': '/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/apache-xml.jar:/system/framework/sec_edm.jar:/system/framework/timakeystore.jar:/system/framework/seccamera.jar:/system/framework/scrollpause.jar:/system/framework/stayrotation.jar:/system/framework/smartfaceservice.jar:/system/framework/commonimsinterface.jar:/system/framework/imsmanager.jar:/system/framework/sprengine.jar:/system/framework/smartbondingservice.jar:/system/framework/secocsp.jar:/system/framework/secEmailBC.jar:/system/framework/knoxvpnuidtag.jar:/system/framework/simageis.jar:/system/framework/qcmediaplayer.jar:/system/framework/WfdCommon.jar:/system/framework/oem-services.jar:/system/framework/org.codeaurora.Performance.jar:/system/framework/vcard.jar:/system/framework/tcmiface.jar', 'ANDROID_STORAGE': '/storage', 'ANDROID_ENTRYPOINT': 'main.pyo', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'PYTHONHOME': '/data/data/org.hello.world/files', 'SECONDARY_STORAGE': '/storage/extSdCard', 'ANDROID_APP_PATH': '/data/data/org.hello.world/files', 'PYTHON_NAME': 'python', 'ANDROID_ARGUMENT': '/data/data/org.hello.world/files', 'LD_PRELOAD': 'libsigchain.so:libNimsWrap.so', 'EMULATED_STORAGE_SOURCE': '/mnt/shell/emulated', 'ANDROID_SOCKET_zygote': '9', 'EXTERNAL_STORAGE': '/storage/emulated/legacy', 'KNOX_STORAGE': '/data/knox/ext_sdcard', 'ANDROID_PRIVATE': '/data/data/org.hello.world/files', 'EMULATED_STORAGE_TARGET': '/storage/emulated', 'ASEC_MOUNTPOINT': '/mnt/asec', 'PYTHONPATH': '/data/data/org.hello.world/files:/data/data/org.hello.world/files/lib', 'ANDROID_ROOT': '/system', 'ANDROID_BOOTLOGO': '1', 'LOOP_MOUNTPOINT': '/mnt/obb', 'ANDROID_ASSETS': '/system/app', 'ANDROID_PROPERTY_WORKSPACE': '8,0', 'VIBE_PIPE_PATH': '/dev/pipes', 'MC_AUTH_TOKEN_PATH': '/efs', 'ANDROID_DATA': '/data'})
I/python  (31712): Android kivy bootstrap done. __name__ is __main__
I/python  (31712): AND: Ran string
I/python  (31712): Run user program, change dir and execute entrypoint
I/python  (31712): main.py
I/python  (31712): [WARNING           ] [Config      ] Older configuration version detected (0 instead of 14)
I/python  (31712): [WARNING           ] [Config      ] Upgrading configuration in progress.
I/python  (31712): [INFO              ] [Logger      ] Record log in /data/data/org.hello.world/files/.kivy/logs/kivy_16-03-30_0.txt
I/python  (31712): [INFO              ] [Kivy        ] v1.9.2-dev0
I/python  (31712): [INFO              ] [Python      ] v3.5.0 (default, Dec 24 2015, 05:56:40) 
I/python  (31712): [GCC 5.3 20151204]
I/python  (31712): ['/data/data/org.hello.world/files/crystax_python/site-packages/kivy']
I/python  (31712): [INFO              ] [Factory     ] 182 symbols loaded
I/python  (31712): [INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif, img_sdl2 (img_pil, img_ffpyplayer ignored)
I/python  (31712): [INFO              ] [Text        ] Provider: sdl2
I/python  (31712): [INFO              ] [OSC         ] using <multiprocessing> for socket
I/python  (31712): [ERROR             ] [Input       ] AndroidJoystick is not supported by your version of linux
I/python  (31712): Traceback (most recent call last):
I/python  (31712):   File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/input/providers/androidjoystick.py", line 17, in <module>
I/python  (31712):     import android  # NOQA
I/python  (31712): ImportError: No module named 'android'
I/python  (31712): During handling of the above exception, another exception occurred:
I/python  (31712): Traceback (most recent call last):
I/python  (31712):   File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/input/providers/__init__.py", line 57, in <module>
I/python  (31712):     import kivy.input.providers.androidjoystick
I/python  (31712):   File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/input/providers/androidjoystick.py", line 20, in <module>
I/python  (31712):     raise Exception('android lib not found.')
I/python  (31712): Exception: android lib not found.
I/python  (31712): [INFO              ] [Window      ] Provider: sdl2
I/python  (31712): [INFO              ] [GL          ] OpenGL version <b'OpenGL ES 3.0 [email protected] [email protected] (CL@)'>
I/python  (31712): [INFO              ] [GL          ] OpenGL vendor <b'Qualcomm'>
I/python  (31712): [INFO              ] [GL          ] OpenGL renderer <b'Adreno (TM) 330'>
I/python  (31712): [INFO              ] [GL          ] OpenGL parsed version: 3, 0
I/python  (31712): [INFO              ] [GL          ] Texture max size <4096>
I/python  (31712): [INFO              ] [GL          ] Texture max units <16>
I/python  (31712): [INFO              ] [Window      ] auto add sdl2 input provider
I/python  (31712): [INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
I/python  (31712): [WARNING           ] [Base        ] Unknown <android> provider
I/python  (31712): [INFO              ] [Base        ] Start application main loop
I/python  (31712): [INFO              ] [GL          ] NPOT texture support is available

@m-mcgowan
Copy link

I'm having the same problem with my kivy app on android (built on ubuntu), so it's great this is fixed! I'm using python-for-android - can someone please spare a few minutes to tell me how I merge the fix?

@haricot
Copy link
Author

haricot commented Apr 12, 2016

@m-mcgowan This bug does not appear on distributions based on Archlinux.
The pull resquests that I proposed are not ideal because it must be placed in rather p4a.
(To test you simply apply the above modif to your Kivy packages and Pyjnius (.local/share/python-for -android/packages/))
I reinstalled a distribution based on Debian but for now I do not own solution and that it works without modif on Archlinux distributions confuses me a little.

@haricot
Copy link
Author

haricot commented Apr 14, 2016

I think the bug comes from python-3.5 on Debian based,
because BLDLIBRARY is set to a static lib.

Debian
~$ python3.5 -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('PY_ENABLE_SHARED'))"
None
~$ python3.5 -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('BLDLIBRARY'))"
-lpython3.5m

~$ python3.2 -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('PY_ENABLE_SHARED'))"
None

~$ python3.2 -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('BLDLIBRARY'))"
-L. -lpython3.2mu

Archlinx
~$ python3.5 -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('PY_ENABLE_SHARED'))"
1
~$ python3.5 -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('BLDLIBRARY'))"
-L. -lpython3.5mu

So I think it needs to be patched python3.5 for debian based but the easiest might be to add temporary patches recipes for Kivy and pyjnius.

In recipes of kivy and pyjnius
(if recipe is for version python3crystax==3.5)( here (if) I don't know how do)

#patch because BLDLIBRARY is set to a static lib with some distributions
    try:
        py35 = sh.Command('python3.5')
        cmdline = shprint(py35, '-c', "import distutils.sysconfig; \
        print(distutils.sysconfig.get_config_var('BLDLIBRARY'))")
        cmdlineout=str((cmdline.stdout).decode("utf-8"))
        if cmdlineout=='-lpython3.5m\n':
            patches=['set_extra_link_args_35.patch']
    except:
       sys.stdout.write("your BLDLIBRARY is already good ! ")

set_extra_link_args_35.patch (in recipe kivy)
("if PY3" is not needed if version of python3crystax==3.5 in recipes)

--- kivy-/setup.py      2016-04-11 00:05:36.000000000 +0200
+++ kivy-patch/setup.py 2016-04-13 12:37:00.740799517 +0200
@@ -270,7 +270,9 @@
         if c != 'msvc':
             for e in self.extensions:
                 e.extra_link_args += ['-lm']
-
+                if PY3:
+                    e.extra_link_args += ['-lpython3.5m']
+
         build_ext.build_extensions(self)

     def update_if_changed(self, fn, content):

set_extra_link_args_35.patch (in recipe pyjnius)
("if PY3" is not needed if version of python3crystax==3.5 in recipes)

--- pyjnius/setup.py    2016-04-05 14:47:00.000000000 +0200
+++ pyjnius-patch/setup.py      2016-04-13 13:53:36.759268308 +0200
@@ -37,6 +37,8 @@
 library_dirs = []
 lib_location = None
 extra_link_args = []
+if PY3:
+    extra_link_args = ['-lpython3.5m']
 include_dirs = []
 install_requires = ['six>=1.7.0']

what do you think ?

@inclement
Copy link
Member

Nice detective work. I don't have a debian-based install, but if you or anyone else would like to make a PR to fix it, it should be great to merge it.

(I suspect the real issue is the way p4a calls python3, which is a bit hacky, so maybe eventually changing that would also fix things).

@scientific-coder
Copy link

Hi,
I got bit by the same bug and applied the proposed patches to add "-lpython3.5m" to kivy and pyjinus with the same results as above.

However, as above, it just fails with an other error :

I/python (31712): [ERROR ] [Input ] AndroidJoystick is not supported by your version of linux
I/python (31712): Traceback (most recent call last):
I/python (31712): File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/input/providers/androidjoystick.py", line 17, in
I/python (31712): import android # NOQA
I/python (31712): ImportError: No module named 'android'
I/python (31712): During handling of the above exception, another exception occurred:
I/python (31712): Traceback (most recent call last):
I/python (31712): File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/input/providers/init.py", line 57, in
I/python (31712): import kivy.input.providers.androidjoystick
I/python (31712): File "/data/data/org.hello.world/files/crystax_python/site-packages/kivy/input/providers/androidjoystick.py", line 20, in
I/python (31712): raise Exception('android lib not found.')
I/python (31712): Exception: android lib not found.

I tried to fix this by adding 'android' to the list of requirements, but that opened a new can of worm ☹.
Has anyone had a working kivy apk with python3.5 built from a Debian based system ?
Any help would be greatly appreciated !

@hackalog
Copy link

The exact same thing is happening here under Ubuntu 16.04. As with Debian, BLDLIBRARY is set to a static lib, and making the above patches to eliminate the _clock.so and _event.so errors results in android lib not found.

@haricot
Copy link
Author

haricot commented Mar 17, 2018

I think this is probably fixed by ed1e1a8

@haricot haricot closed this as completed Mar 17, 2018
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

5 participants