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

Pil's recipe migrated to Pillow (Fixed Headers) #786

Closed
wants to merge 7 commits into from

Conversation

opacam
Copy link
Member

@opacam opacam commented Jun 12, 2016

This PR has the words "optional for Python 2.7.11" to keep reference to the original PR #775 (Python 2.7.11). This depends on PRs: #784, #785 and #793.

I migrated the Pil's recipe to Pillow because that last one is better maintained and more updated.

This PR could work without all the stuff related with Python 2.7.11 but it would need some little changes into the libpng's recipe (#785) to avoid conflicts with the current state of pygame's build.

@inclement
Copy link
Member

Switching to pillow is definitely a good change, but maybe it should be a new recipe ('pillow'). On the other hand, I know it's a total pil replacement, so maybe that doesn't matter.

@opacam
Copy link
Member Author

opacam commented Jun 19, 2016

I already thought about creating a new recipe but finally I decided to keep the initial PIL recipe to not create confusion, avoid duplicates and, this way, all the users who use the PIL recipe will receive the update silently without changing any build script that already has. If you think that create a new recipe for pillow is the right way to go it could be done easily, so, only tell me and I will do the necessary changes.

@tshirtman
Copy link
Member

As long as any recipe depending on pil still builds and works with pillow, i think it could be merged in this way, would be better than having to manually switch all of them to pillow…

@opacam opacam changed the title Pil's recipe migrated to Pillow (optional for Python 2.7.11) Pil's recipe migrated to Pillow (don't merge...wait until fix the headers) Aug 12, 2016
@AndreMiras
Copy link
Member

That was an interesting pull request, it's a shame we didn't make it to the end :'(

AndreMiras added a commit to kivy-garden/garden.zbarcam that referenced this pull request Oct 19, 2017
@KeyWeeUsr
Copy link
Contributor

@AndreMiras You can still pull from that branch to preserve the original author's changes, rebase it and finish if you want because I'm not sure if @opacam still knows what's going on in there. Also, there's probably a problem with #793 not being merged, which was mentioned as a dependency for this PR.

@opacam opacam changed the title Pil's recipe migrated to Pillow (don't merge...wait until fix the headers) Pil's recipe migrated to Pillow (Fixed Headers) Nov 3, 2017
@opacam
Copy link
Member Author

opacam commented Nov 3, 2017

It has been tested with sdl2 bootstrap (on a phone with android 7.0, nougat) but needs more testing before merged...
On my tests I include the freetype and harfbuzz libraries inside my apk and I forced to be load when app is initialized (modifying the file PythonUtil.java from the sdl2 bootstrap).

Notice that the current recipes for freetype and harfbuzz are made in some way that the generated libraries are not included into the final apk (probably to avoid conflicts with the distributed android libs...same problem happened to the old openssl recipe, until changed to versioned library).
I already have a custom recipe for this versioned libraries and another pil/pillow recipe patched for this libs...but maybe that is not necessary for android versions 7.0+ (Nougat) because I think that introduced support for versioned libs at some point.

Or...may be it will require to change some other recipes non related with this recipe in order to make it fully functionable...for all Android versions

The affected recipes/files I think would be: freetype, harfbuzz and PythonUtil.java file for all bootstraps.

Should I made a pull request with mentioned versioned libs and patched pil recipe?

@AndreMiras
Copy link
Member

It has been tested with sdl2 bootstrap (on a phone with android 7.0, nougat) but needs more testing before merged...

I have to say, I love the release early release often approach. So if it's working on most of our use cases, why not merging it? At some point the best way to find out is to just spread it :)
Worst thing than can happen is, a developer use it and find issues, then he will create a bug report or even better a pull request.
Yes it can bring instability, but it won't be like a regression since this recipe didn't exist before. Kivy and p4a are great but they're kinda experimental projects right?
My fear is that we try to get it perfect, postpone it again and then something comes up and we don't have time for it anymore.

@ghost
Copy link

ghost commented Aug 16, 2018

For what it's worth, @inclement guided me on how to best try to resolve the current merge conflict. The result is here: https://github.com/JonasT/python-for-android/tree/updates-pil (You can test it with pip install https://github.com/JonasT/python-for-android/archive/updates-pil.zip and then run p4a with --requirements=python3crystax,pil)

However, it doesn't work because there seems to be a problem with the build flags:

running build_ext
building 'PIL._imaging' extension
Building using 4 processes
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/crystax-ndk/platforms/android-19/arch-arm -isysroot /crystax-ndk/platforms/android-19/arch-arm -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python3.5 -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -L/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/simd -L/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -L/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/objs/.libs -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -L/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src/.libs -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/crystax-ndk/platforms/android-19/arch-arm -isysroot /crystax-ndk/platforms/android-19/arch-arm -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python3.5 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/crystax-ndk/sources/python/3.5/include/python -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python2.7 -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -L/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/simd -L/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -L/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/objs/.libs -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -L/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src/.libs -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/root/.local/share/python-for-android/build/other_builds/pil-python3crystax/armeabi-v7a/pil/libImaging -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg -I/crystax-ndk/platforms/android-19/arch-arm/usr/include -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -I/crystax-ndk/platforms/android-19/arch-arm -I/crystax-ndk/sources/python/3.5/include/python -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/simd -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -I/usr/include -I/usr/include/python3.6m -c _imaging.c -o build/temp.linux-x86_64-3.6/_imaging.o
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/crystax-ndk/platforms/android-19/arch-arm -isysroot /crystax-ndk/platforms/android-19/arch-arm -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python3.5 -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -L/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/simd -L/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -L/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/objs/.libs -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -L/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src/.libs -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/crystax-ndk/platforms/android-19/arch-arm -isysroot /crystax-ndk/platforms/android-19/arch-arm -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python3.5 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/crystax-ndk/sources/python/3.5/include/python -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python2.7 -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -L/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/simd -L/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -L/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/objs/.libs -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -L/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src/.libs -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/root/.local/share/python-for-android/build/other_builds/pil-python3crystax/armeabi-v7a/pil/libImaging -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg -I/crystax-ndk/platforms/android-19/arch-arm/usr/include -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -I/crystax-ndk/platforms/android-19/arch-arm -I/crystax-ndk/sources/python/3.5/include/python -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/simd -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -I/usr/include -I/usr/include/python3.6m -c outline.c -o build/temp.linux-x86_64-3.6/outline.o
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/crystax-ndk/platforms/android-19/arch-arm -isysroot /crystax-ndk/platforms/android-19/arch-arm -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python3.5 -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -L/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/simd -L/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -L/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/objs/.libs -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -L/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src/.libs -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/crystax-ndk/platforms/android-19/arch-arm -isysroot /crystax-ndk/platforms/android-19/arch-arm -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python3.5 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/crystax-ndk/sources/python/3.5/include/python -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python2.7 -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -L/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/simd -L/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -L/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/objs/.libs -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -L/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src/.libs -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/root/.local/share/python-for-android/build/other_builds/pil-python3crystax/armeabi-v7a/pil/libImaging -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg -I/crystax-ndk/platforms/android-19/arch-arm/usr/include -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -I/crystax-ndk/platforms/android-19/arch-arm -I/crystax-ndk/sources/python/3.5/include/python -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/simd -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -I/usr/include -I/usr/include/python3.6m -c libImaging/ConvertYCbCr.c -o build/temp.linux-x86_64-3.6/libImaging/ConvertYCbCr.o
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/crystax-ndk/platforms/android-19/arch-arm -isysroot /crystax-ndk/platforms/android-19/arch-arm -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python3.5 -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -L/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/simd -L/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -L/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/objs/.libs -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -L/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src/.libs -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/crystax-ndk/platforms/android-19/arch-arm -isysroot /crystax-ndk/platforms/android-19/arch-arm -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python3.5 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/crystax-ndk/sources/python/3.5/include/python -I/root/.local/share/python-for-android/build/python-installs/unnamed_dist_2/include/python2.7 -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -L/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/jni/simd -L/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/obj/local/armeabi-v7a -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -L/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/objs/.libs -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -L/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src/.libs -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/root/.local/share/python-for-android/build/other_builds/pil-python3crystax/armeabi-v7a/pil/libImaging -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg -I/crystax-ndk/platforms/android-19/arch-arm/usr/include -I/root/.local/share/python-for-android/build/other_builds/freetype/armeabi-v7a/freetype/include -I/crystax-ndk/platforms/android-19/arch-arm -I/crystax-ndk/sources/python/3.5/include/python -I/root/.local/share/python-for-android/build/other_builds/png/armeabi-v7a/png/jni -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/android -I/root/.local/share/python-for-android/build/other_builds/jpeg/armeabi-v7a/jpeg/simd -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz -I/root/.local/share/python-for-android/build/other_builds/harfbuzz/armeabi-v7a/harfbuzz/src -I/usr/include -I/usr/include/python3.6m -c libImaging/Bands.c -o build/temp.linux-x86_64-3.6/libImaging/Bands.o
In file included from /usr/include/stdlib.h:55:0,
                 from /crystax-ndk/sources/python/3.5/include/python/Python.h:34,
                 from libImaging/ImPlatform.h:10,
                 from libImaging/Imaging.h:14,
                 from libImaging/ConvertYCbCr.c:15:
/usr/include/bits/floatn.h:75:1: error: unknown machine mode '__TC__'
 typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
 ^
/usr/include/bits/floatn.h:87:9: error: unknown type name '__float128'
 typedef __float128 _Float128;
         ^
In file included from /usr/include/stdlib.h:55:0,
                 from /crystax-ndk/sources/python/3.5/include/python/Python.h:34,
                 from _imaging.c:76:
/usr/include/bits/floatn.h:75:1: error: unknown machine mode '__TC__'
 typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
 ^
/usr/include/bits/floatn.h:87:9: error: unknown type name '__float128'
 typedef __float128 _Float128;
         ^
In file included from /usr/include/stdlib.h:55:0,
                 from /crystax-ndk/sources/python/3.5/include/python/Python.h:34,
                 from outline.c:20:
/usr/include/bits/floatn.h:75:1: error: unknown machine mode '__TC__'
 typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
 ^
In file included from /usr/include/stdlib.h:55:0,
                 from /crystax-ndk/sources/python/3.5/include/python/Python.h:34,
                 from libImaging/ImPlatform.h:10,
                 from libImaging/Imaging.h:14,
                 from libImaging/Bands.c:19:
/usr/include/bits/floatn.h:75:1: error: unknown machine mode '__TC__'
 typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
 ^
/usr/include/bits/floatn.h:87:9: error: unknown type name '__float128'
 typedef __float128 _Float128;
         ^
/usr/include/bits/floatn.h:87:9: error: unknown type name '__float128'
 typedef __float128 _Float128;
         ^

It appears the compiler is called with both the proper directories like -isysroot /crystax-ndk/platforms/android-19/arch-arm/ and -I/crystax-ndk/platforms/android-19/arch-arm/usr/include, but also this one: -I/usr/include. This leads to a conflict, and the compiler picking the wrong /usr/include/stdlib.h instead of a proper choice like /crystax-ndk/platforms/android-19/arch-arm/usr/include/stdlib.h (which is also in the include path) - and as a result, tries to compile standard lib code that is meant for Linux and not for Android.

So the order or something about the -I arguments probably needs to be changed to make it pick the proper standarad headers. But I'm not sure what exactly (since /usr/include could be legitimately needed for other stuff), or how to make p4a do that (since not all of the flags/parameters are generated by the recipe itself).

@krinnewitz
Copy link
Contributor

Hi @Jonast, I have created a working recipe for pillow: https://github.com/plapadoo/python-for-android/tree/feature-pillow/pythonforandroid/recipes/Pillow

I also came accross the issue with the wrong stdlib.h being picked. I ended up using -nostdinc to fix it.

My recipe is only tested with python3crystax and it contains a hardcoded path. So I will not contribute it, but maybe it helps you to get your PR done. Feel free to copy & paste from my recipe if you find it useful.

@ghost
Copy link

ghost commented Aug 21, 2018

@krinnewitz it's not really my pull request to start with, I just tried to see if it works on latest master (obviously doesn't). I barely understand how the whole cflags magic in p4a works, so I'd probably need ten times as long to actually get it to work than someone who has an idea what all of it actually does... so I don't think I'm a good pick to finish it. However, I'll see if your hardcoded path version works for me for the time being to just get my app to somehow to launch

Edit: and I'm for sure the wrong person to advise on how to get rid of the hardcoded path. I barely now anything about the NDK myself

@krinnewitz
Copy link
Contributor

@Jonast ok, no problem ;) Thanks anyway for sharing your work on a Pillow recipe.

When you test my recipe, please let me know if it works for you. Maybe I will try to contribute it someday.

@ghost
Copy link

ghost commented Aug 24, 2018

@krinnewitz I tried plapadoo@eaa9bad and it built just fine for me. I also like that you named it Pillow and not PIL, since that's what anyone coming from Python 3 on the desktop would expect to be required to use.

I didn't test actually using it at runtime yet since I'm stuck on troubles with lzma right now, but it looks pretty promising! 🎉

@ghost
Copy link

ghost commented Aug 25, 2018

Ok, I just managed to get my app to run and tested it. @krinnewitz 's Pillow recipe works perfectly for me, loads up images and all! 🎉

Why I think @krinnewitz 's code should be merged:

  1. It is named Pillow, therefore won't interfere or regress anything for PIL
  2. Absolute game changer for Python 3 apps that work anywhere outside of the regular kivy universe, and/or do any sort of image processing
  3. The hardcoded NDK path appears to be fixed, so I can't see anything particularly ugly about the code
  4. At least as far as I'm concerned, it works 👍 (and if it still had bugs, it's not like it'd work worse than before)

@krinnewitz
Copy link
Contributor

Thanks for you feedback @Jonast. I have already fixed the hard-coded path. Currently, there are issues with my Pillow recipe under python 2.7. I will try to fix it and create a PR soon!

@ghost
Copy link

ghost commented Aug 25, 2018

@krinnewitz right now putting Pillow as requirement for Python 2 doesn't work anyway - only PIL does - so just as a note, I don't see why this would need to be held back until Python 2.7 works.

Sorry if I sound pushy, this change is pretty huge for me so don't mind me being super excited about it 😀 🎉

@AndreMiras
Copy link
Member

Why don't you guys create a dedicated pull request out of it?
I would also be glad to review/merge it and use it for https://github.com/kivy-garden/garden.zbarcam
So go ahead and create a dedicated pull request.
I'm referring to that comment:
#786 (comment)

@AndreMiras
Copy link
Member

Thanks you all for the efforts, we made it 😄
#1339

@AndreMiras AndreMiras closed this Aug 26, 2018
@ghost
Copy link

ghost commented Aug 26, 2018

Yay! 😍

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

Successfully merging this pull request may close these issues.

6 participants