Numpy support w/ python3crystax
See original GitHub issueI’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:
- (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
). - 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:
- Created 7 years ago
- Comments:19 (7 by maintainers)
Top GitHub Comments
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.
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