question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Numpy support w/ python3crystax

See original GitHub issue

I’m trying to get my app to compile with Python 3 using the Crystax NDK. Everything is set up, and if I try to push my app to my device without specifying that numpy is needed, everything works fine. However, numpy raises a few issues:

  1. (easily fixed) The recipe needs to be modified such that python3crystax is supported. Currently, it only claims python2 support, but that’s overridden easily enough (depends = ['python2'] -> depends = [('python3crystax', 'python2)] in the __init__.py).
  2. The compiler claims it can’t find -lcrystax:
...
don't know how to compile Fortran code on platform 'posix'
C compiler: /usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/wwoods/walt/dev/kivy/crystax-ndk-10.3.2/platforms/android-19/arch-arm -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/wwoods/walt/dev/kivy/crystax-ndk-10.3.2/platforms/android-19/arch-arm -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC

compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -I/home/wwoods/miniconda3/envs/kivy/include/python3.5m -c'
ccache: _configtest.c
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/wwoods/walt/dev/kivy/crystax-ndk-10.3.2/platforms/android-19/arch-arm _configtest.o -o _configtest
/home/wwoods/walt/dev/kivy/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.3/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lcrystax
collect2: error: ld returned 1 exit status
/home/wwoods/walt/dev/kivy/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.3/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lcrystax
collect2: error: ld returned 1 exit status
failure.
removing: _configtest.c _configtest.o

Everything except numpy works fine, so I think that it’s just Numpy’s recipe that needs a minor alteration. Oddly though, specifying a LIBRARY_PATH or LDFLAGS does not have any effect. In fact, if I add a get_recipe_env to the NumpyRecipe that prints out what super().get_recipe_env(arch) contains, it has LDFLAGS with the appropriate path on there. Running the linker by hand with the given flags find the library fine (ld $(LDFLAGS) -lcrystax --verbose). In the context of python-for-android though, the linker always fails to find libcrystax.a.

Any help appreciated, thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Abysselenecommented, Apr 13, 2018

Hi, I’m trying to make numpy work with py3crystax too (internship in a lab and they need numpy on android with kivy and python3) so I’ll work on it for some time.

If I get interesting results I’ll communicate them here, also if you don’t have time to do some tests but have ideas about what to do, share them here. If I have enough time I’ll try your suggestions and post the results.

1reaction
krinnewitzcommented, Aug 8, 2018

Hi guys, I think I figured it out!

Here is the fixed recipe with a minimal example application: https://github.com/plapadoo/p4a-numpy

This isn’t well-tested. So I will collect more feedback before creating a PR. Please let me know if the fixed recipe works for you.

Thanks to all the people who already put some effort into this in the past. Especially @Abysselene and @frmdstryr

Read more comments on GitHub >

github_iconTop Results From Across the Web

kivy@groups.io | Updates to Github
#882 Numpy support w/ python3crystax. I'm trying to get my app to compile with Python 3 using the Crystax NDK. Everything is set...
Read more >
Buildozer(Conda Python3 Environment) + kivy, numpy, scipy ...
I installed buildozer following given "Installing Buildozer with python3 support". Surprisingly buildozer do not appear in "conda list" of my environment ...
Read more >
Can't build Kivy project with buildozer and python3crystax
Sorry for possible stupid question, but today I spent ~5 hours trying to build simple apk with Python3, Buildozer and Crystax NDK.
Read more >
NumPy: the absolute basics for beginners
It adds powerful data structures to Python that guarantee efficient calculations with arrays and matrices and it supplies an enormous library of high-level ......
Read more >
NumPy 1.20.0 Release Notes
The Python versions supported for this release are 3.7-3.9, support for Python 3.6 ... The table below shows the full list of deprecated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found