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

p4a built x86_64 library(psutil, "ELF 64-bit LSB shared object, x86-64") for ARM #2506

Closed
5 tasks
killangell opened this issue Oct 15, 2021 · 4 comments
Closed
5 tasks

Comments

@killangell
Copy link

Checklist

  • the issue is indeed a bug and not a support request
  • issue doesn't already exist: https://github.com/kivy/python-for-android/issues
  • I have a short, runnable example that reproduces the issue
  • I reproduced the problem with the latest development version (p4a.branch = develop)
  • I used the grave accent (aka backticks) to format code or logs when appropriated

Versions

  • Python: 3.8
  • OS:
  • Kivy:
  • Cython:
  • OpenJDK:

Description

// REPLACE ME: What are you trying to get done, what has happened, what went wrong, and what did you expect?

buildozer.spec

Command:

Compile command
p4a apk --private $HOME/work/project/biga_futures/ --package=org.kivy.biga_futures --name "biga_futures" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy,pandas,typing_extensions,chardet,requests,urllib3,psutil --permission PERMISSIONS INTERNET

Logs

Compiled result
Bad _psutil_linux.so for armeabi-v7a and arm64-v8a

kivy@kivy-virtual-machine:/$ file /home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a/_python_bundle/_python_bundle/site-packages/psutil/_psutil_linux.so
/home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a/_python_bundle/_python_bundle/site-packages/psutil/_psutil_linux.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7d5053a326cc3a710e61fdd8dfc017217c579204, with debug_info, not stripped
kivy@kivy-virtual-machine:/$ file /home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__arm64-v8a/_python_bundle/_python_bundle/site-packages/psutil/_psutil_linux.so
/home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__arm64-v8a/_python_bundle/_python_bundle/site-packages/psutil/_psutil_linux.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7d5053a326cc3a710e61fdd8dfc017217c579204, with debug_info, not stripped

Good examples of other .so
kivy@kivy-virtual-machine:/$ file /home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/_event.so
/home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/_event.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, stripped
kivy@kivy-virtual-machine:/$ file /home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a/_python_bundle/_python_bundle/site-packages/pandas/_libs/algos.so
/home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a/_python_bundle/_python_bundle/site-packages/pandas/_libs/algos.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, stripped

Error in Android

10-15 20:37:58.354 23038 23162 I python : Traceback (most recent call last):
10-15 20:37:58.354 23038 23162 I python : File "/home/kivy/work/project/biga_futures/main.py", line 1, in
10-15 20:37:58.354 23038 23162 I python : File "/home/kivy/work/project/biga_futures/tqsdk/init.py", line 6, in
10-15 20:37:58.355 23038 23162 I python : File "/home/kivy/work/project/biga_futures/tqsdk/api.py", line 39, in
10-15 20:37:58.355 23038 23162 I python : File "/home/kivy/work/project/biga_futures/psutil/init.py", line 99, in
10-15 20:37:58.355 23038 23162 I python : File "/home/kivy/work/project/biga_futures/psutil/_pslinux.py", line 26, in
10-15 20:37:58.355 23038 23162 I python : ImportError: cannot import name '_psutil_linux' from partially initialized module 'psutil' (most likely due to a circular import) (./psutil/init.pyc)
10-15 20:37:58.355 23038 23162 I python : Python for android ended.

@RobertFlatt
Copy link
Contributor

Not exactly, psutil was download by pip because psutil has no p4a recipe https://github.com/kivy/python-for-android/tree/develop/pythonforandroid/recipes and the downloaded PyPi package is not pure Python and does not support Android https://pypi.org/project/psutil/

The downloaded package contained an x86_64 binary for some other platform, which is what you see.

You might consider writing a recipe for psutil, but Android is not POSIX compliant so I'd guess that would be hard or impossible (but I could be wrong).

This forum is for development issues, if you have any further usage issues please use https://discord.gg/UJ3PGbhs or https://groups.google.com/g/kivy-users

@killangell
Copy link
Author

Yes, thanks. I wrote a recipe and solved the problem.

kivy@kivy-virtual-machine:/$ file /home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages/psutil/_psutil_linux.cpython-38-x86_64-linux-gnu.so
/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages/psutil/_psutil_linux.cpython-38-x86_64-linux-gnu.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, stripped
kivy@kivy-virtual-machine:/$
kivy@kivy-virtual-machine:/$
kivy@kivy-virtual-machine:/$ sudo find / -name psutil
/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages/psutil
/home/kivy/.local/share/python-for-android/build/other_builds/psutil
/home/kivy/.local/share/python-for-android/build/other_builds/psutil/armeabi-v7a__ndk_target_21/psutil
/home/kivy/.local/share/python-for-android/build/other_builds/psutil/armeabi-v7a__ndk_target_21/psutil/psutil
/home/kivy/.local/share/python-for-android/build/other_builds/psutil/armeabi-v7a__ndk_target_21/psutil/build/temp.linux-x86_64-3.8/psutil
/home/kivy/.local/share/python-for-android/build/other_builds/psutil/armeabi-v7a__ndk_target_21/psutil/build/lib.linux-x86_64-3.8/psutil
/home/kivy/.local/share/python-for-android/build/python-installs/unnamed_dist_1/psutil
/home/kivy/.local/share/python-for-android/packages/psutil
/home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a/_python_bundle/_python_bundle/site-packages/psutil
/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/recipes/psutil
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/local/lib/python3.8/dist-packages/psutil
kivy@kivy-virtual-machine:/$ cat /home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/recipes/psutil/init.py

from pythonforandroid.recipe import PythonRecipe

class PsUitlRecipe(PythonRecipe):
name = 'psutil'
version = '5.8.0'
url = 'https://files.pythonhosted.org/packages/e1/b0/7276de53321c12981717490516b7e612364f2cb372ee8901bd4a66a000d7/psutil-{version}.tar.gz'

depends = ['setuptools', 'pytz']

call_hostpython_via_targetpython = False
install_in_hostpython = True

recipe = PsUitlRecipe()
kivy@kivy-virtual-machine:/$

@QGB
Copy link

QGB commented Apr 30, 2023

@killangell I use your recipes. But still 64-bit error, not 32-bit

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

3 participants