Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buildozer can't compile Cython

I am trying to build my kivy application, but having run buildozer android debug --verbose the only I get is following:

[...]

Run prebuild
Call prebuild_hostpython
Call prebuild_python
Call prebuild_sdl
Call prebuild_pygame
Call prebuild_pyjnius
Call prebuild_android
Call prebuild_kivy
Run build
Skipped build_hostpython
Skipped build_python
Skipped build_sdl
Skipped build_pygame
Call build_pyjnius
Entering in ARM environment
Compiler found at /home/michal/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
/home/michal/Dokumenty/Projekty/Labirynt/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running build_ext
building 'jnius' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/michal/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -DNDEBUG -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/michal/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -fPIC -I/home/michal/Dokumenty/Projekty/Labirynt/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -c jnius/jnius.c -o build/temp.linux-x86_64-2.7/jnius/jnius.o
jnius/jnius.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
 #error Do not use this file, it is the result of a failed Cython compilation.
  ^
error: command 'arm-linux-androideabi-gcc' failed with exit status 1

Error compiling Cython file:
------------------------------------------------------------
...
            if py_arg is None:
                j_args[index].l = NULL
            elif isinstance(py_arg, basestring) and \
                    argtype in ('Ljava/lang/String;', 'Ljava/lang/Object;'):
                j_args[index].l = j_env[0].NewStringUTF(
                        j_env, <char *><bytes>py_arg.encode('utf-8'))
                              ^
------------------------------------------------------------

jnius/jnius_conversion.pxi:54:31: Casting temporary Python object to non-numeric non-Python type
/home/michal/Dokumenty/Projekty/Labirynt/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running build_ext
building 'jnius' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/michal/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -DNDEBUG -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/michal/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -fPIC -I/home/michal/Dokumenty/Projekty/Labirynt/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -c jnius/jnius.c -o build/temp.linux-x86_64-2.7/jnius/jnius.o
jnius/jnius.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
 #error Do not use this file, it is the result of a failed Cython compilation.
  ^
error: command 'arm-linux-androideabi-gcc' failed with exit status 1
# Command failed: ./distribute.sh -m "kivy" -d "testapp"

I'm using Archlinux, 64bit, python2 2.7.8-2, with aur/python2-kivy-git.

When i'm trying to install aur/python2-kivy I get

Found GLES 2.0 headers at /usr/include/GLES2/gl2.h
 /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'dependency_links'
   warnings.warn(msg)
 /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
   warnings.warn(msg)
running build
running build_py
running build_ext
Build configuration is:
 * use_rpi = False
 * use_opengl_es2 = True
 * use_opengl_debug = False
 * use_glew = False
 * use_sdl = False
 * use_ios = False
 * use_mesagl = False
 * use_x11 = False
 * use_gstreamer = True
 * use_avfoundation = False
Generate config.h
Generate config.pxi
Detected compiler is unix
skipping 'kivy/graphics/texture.c' Cython extension (up-to-date)
skipping 'kivy/graphics/vertex.c' Cython extension (up-to-date)
skipping 'kivy/graphics/fbo.c' Cython extension (up-to-date)
skipping 'kivy/graphics/context.c' Cython extension (up-to-date)
skipping 'kivy/properties.c' Cython extension (up-to-date)
skipping 'kivy/graphics/context_instructions.c' Cython extension (up-to-date)
skipping 'kivy/graphics/instructions.c' Cython extension (up-to-date)
skipping 'kivy/graphics/stencil_instructions.c' Cython extension (up-to-date)
skipping 'kivy/graphics/opengl.c' Cython extension (up-to-date)
skipping 'kivy/graphics/transformation.c' Cython extension (up-to-date)
skipping 'kivy/graphics/vbo.c' Cython extension (up-to-date)
skipping 'kivy/graphics/opengl_utils.c' Cython extension (up-to-date)
skipping 'kivy/graphics/c_opengl_debug.c' Cython extension (up-to-date)
skipping 'kivy/graphics/gl_instructions.c' Cython extension (up-to-date)
cythoning kivy/lib/gstplayer/_gstplayer.pyx to kivy/lib/gstplayer/_gstplayer.c

 Error compiling Cython file:
 ------------------------------------------------------------
 ...

             g_object_set_void(self.playbin, 'video-sink', self.fakesink)

         # configure playbin
         g_object_set_int(self.pipeline, 'async-handling', 1)
         c_uri = <bytes>self.uri.encode('utf-8')
                ^
 ------------------------------------------------------------

 kivy/lib/gstplayer/_gstplayer.pyx:259:16: Storing unsafe C derivative of temporary Python reference
building 'kivy.lib.gstplayer._gstplayer' extension
gcc -pthread -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/python2.7 -c kivy/lib/gstplayer/_gstplayer.c -o build/temp.linux-x86_64-2.7/kivy/lib/gstplayer/_gstplayer.o
kivy/lib/gstplayer/_gstplayer.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
 #error Do not use this file, it is the result of a failed Cython compilation.
  ^
 error: command 'gcc' failed with exit status 1

How can I make it work?

like image 923
Dekakaruk Avatar asked Oct 01 '14 19:10

Dekakaruk


1 Answers

This is an issue with the Cython version 0.21 and old code. The easiest solution is to downgrade Cython to 0.20, which works.

To use the newer Cython, delete the downloaded pyjnius and let buildozer download the most recent version:

rm ~/.buildozer/android/packages/pyjnius-master.zip

But the newer Cython also needs newer Kivy code. In your buildozer.spec, change kivy in the requirements to kivy==master to get the most recent Kivy code.

like image 84
kitti Avatar answered Oct 22 '22 00:10

kitti