Skip to content

ONNXruntime lib open failed due to 64-bit #2880

@ktprms23

Description

@ktprms23

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.7
  • OS: Ubuntu 18.04
  • Kivy: 2.1.0
  • Cython: 3.0.0
  • OpenJDK: 11.0.18

Description

We are trying to build a project with the onnxruntime library. Due to the onnxruntime is not on the recipes list so it will be build with the pip command by default.

The apk can be generated successfully but will crashed when it try to load the onnxruntime lib due to the lib is 64-bit.

Does anyone have idea to build this library? From the onnxruntime document we can build a standalone libonnxruntime.so, but it is not suitable to use for our project.

buildozer.spec

Command:
We use p4a to generate the apk so there is no buildozer.spec file.

p4a apk --private ./ --requirements=python3,kivy,...,.......,onnxruntime --bootstrap=sdl2 --arch=armeabi-v7a --package=example.python2 --name "test_python2" --dist_name="test_python2" --ndk_dir=... --sdk_dir=... --release --android-api 30 --version 1.1

Logs

The app will crash with the following log.

07-28 04:15:59.246  3478  3567 I python  :  Traceback (most recent call last):
07-28 04:15:59.246  3478  3567 I python  :    File "/home/davidpc/projects/python/test_python/test_python2/main.py", line 6, in <module>
07-28 04:15:59.248  3478  3567 I python  :    File
"/home/davidpc/.local/share/python-for-android/build/python-installs/test_python/armeabi-v7a/onnxruntime/__init__.py", line 55, in <module>
07-28 04:15:59.249  3478  3567 I python  :    File "/home/davidpc/.local/share/python-for-android/build/python-installs/test_python/armeabi-v7a/onnxruntime/__init__.py", line 23, in <module>
07-28 04:15:59.249  3478  3567 I python  :    File "/home/davidpc/.local/share/python-for-android/build/python-installs/test_python/armeabi-v7a/onnxruntime/capi/_pybind_state.py", line 33, in <module>
07-28 04:15:59.250  3478  3567 I python  :  ImportError: dlopen failed: "/data/data/example.python2/files/app/_python_bundle/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.so" is 64-bit instead of 32-bit
07-28 04:15:59.250  3478  3567 I python  : Python for android ended.

We check the so file and it seems the onnxruntime_pybind11_state.so was built with host compiler.

# file onnxruntime_pybind11_state.so
onnxruntime_pybind11_state.so: ELF 64-bit LSB shared object, X86-64, version 1 (SYSV) dynamically linked, BuildID=......

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions