pyotherside
pyotherside copied to clipboard
Crash on start python on android
Hi. Please help me build python for android. I tried to run this example on your phone: https://github.com/ldanzinger/PyOtherSideForArcGIS/tree/master/01_HelloWorld but after launch, the app closes with error.
If in https://github.com/ldanzinger/PyOtherSideForArcGIS/blob/master/01_HelloWorld/main.qml to delete 29-35 and 45-52 lines, the application starts successfully.
similarly, when you run the example from this repository (pyotherside/examples/qrc). The log error I attached. log.txt
I assumed that the error in the Python and copied binary file python3m on the phone and it turned out that at startup it outputs: Error: only position independent executables (PIE) are supported.
I fixed that Python was compiled with PIE support and run on the phone, but ready apk still app crashes.
Since https://github.com/thp/python3-android is not available, I used this repositories: https://github.com/GRRedWings/python3-android (v3.5) or https://github.com/rave-engine/python3-android (v3.4).
My workflow:
- Download and install last sdk (android-sdk_r24.4.1-linux.tgz), ndk (android-ndk-r12b-linux-x86_64.zip) and Qt (qt-opensource-linux-x64-android-5.7.0.run)
- git clone https://github.com/GRRedWings/python3-android
- in file 'env' installs versions of the sdk and ndk
- for PIE: in python3-android/mk/python/VERSION/build.sh after patchs and before ./configure. add bash
- make
- for PIE: replace all
-Xlinker -export-dynamic
on-Xlinker -export-dynamic -fPIE -Wl,-pie
and exit in terminal for close bash. - cd build/.../lib/ && zip -r pythonlib.zip *
- git clone https://github.com/thp/pyotherside.git && copy pythonlib.zip to pyotherside/src
- edit pyotherside/python.pri:
QMAKE_LIBS += -L/home/user/python3-android/build/12b-21-arm-linux-androideabi-4.9/lib -lpython3.5m -ldl -lm -lc -lssl -lcrypto
QMAKE_CXXFLAGS += -I/home/user/python3-android/build/12b-21-arm-linux-androideabi-4.9/include/python3.5m/
- /home/user/Qt5.7.0/5.7/android_armv7/bin/qmake PYTHON_CONFIG=python3.5-config
- make
- copy libpyothersideplugin.so and qmldir to /home/user/Qt5.7.0/5.7/android_armv7/qml/io/thp/pyotherside/
If you run as is, on android, the program will fail with an error indicating that not enough python3.5m.so. Fix it:
- copy python3.5m.so to /home/user/Qt5.7.0/5.7/android_armv7/lib && chmod 777 /home/user/Qt5.7.0/5.7/android_armv7/lib/python3.5m.so
- Open installed QtCreator, open example project, make and deploy on android. And error on running.
- Crash application)
I'm use: linux debian amd64 android ndk r12b sdk 25.1.7 Qt5.7.0
and android 5.1.1
Today I repeated the steps from the documentation, including use API 14. I used to miss this point, so they had to fix PIE. But at API 14, the application crashes when calling python.
Please tell me, what am I doing wrong.
Have you figured out how to use PyOtherSide on Android? Adding PIE doesn't work, it tries to link the app against pthread which isn't available under Android.
I got error dlopen failed: library "libpython3.9.so.1.0" not found
when trying this project. How can I use libpython3.9.so only?
You can usually just create a symlink or rename the library.
I renamed the library before and I got the same error :/