Help iwth a recipe: ONNX

121 views
Skip to first unread message

Nemanja Milošević

unread,
Jun 7, 2022, 4:48:13 PM6/7/22
to Kivy users support
Dear all,

I am having issues adding ONNX (https://github.com/onnx/onnx) library support to p4a as a new recipe. I would like to ask for help from more experienced members. :)

A minimal example would be as follows:

In buildozer.spec:

requirements = python3,kivy,onnx
android.archs = arm64-v8a

And the recipe I have written (so far) is here:

https://gist.github.com/nmilosev/2f0090c4f86637f04ac83cbfe835f8bc

In my experience the ONNX library seems to be difficult to build sadly, even though we have all the dependencies: protobuf and pybind11.

In the recipe there are a few things that need to be setup, namely path to protobuf shared library, some ONNX specific CMAKE args and lastly, similar to gevent (https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipes/gevent/__init__.py) recipe we need to move flags to LIBS environment variable.

The build fails with a weird error (wrong compiler?) as so:

https://gist.github.com/nmilosev/92558985e9103321dfdbac8770273fcf

And I am unsure where to go next. My gut tells me its protobuf complier related as it uses protoc from the host, and not from the target distribution (or a static one), but I am not sure why the error. :(

Any insight would be greatly appreciated. Full log for the ONNX build is attached if it helps. The host is a Docker container used for building (based on buildozer Docker image) with protobuf compiler and protobuf libraries added.

Thank you in advance for your help!

Best regards,
Nemanja
log.txt

Robert

unread,
Jun 7, 2022, 8:36:16 PM6/7/22
to Kivy users support
Non trivial recipes are essentially custom code, because build instructions are custom.
So you probably won't find anybody who already knows the answer, or anybody who will take the considerable time to figure it out.

Your best resource is the existing recipes.

For example this one uses cmake and references the pybind11 headers, missing pybind headers might be the error message shown (or not?).
Of course any utility in that suggestion will depend on the respective CMakeLists.txt files.

With that not particularly helpful advice, when you get it working please consider adding it to p4a using a PR.
Reply all
Reply to author
Forward
0 new messages