当前位置: 首页 > 工具软件 > Buildozer > 使用案例 >

Android无法编译,android – Buildozer无法编译Cython

盛城
2023-12-01

我正在尝试构建我的kivy应用程序,但已经运行buildozer android debug –verbose我唯一得到的是:

[...]

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, 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"

我正在使用Archlinux,64位,python2 2.7.8-2,带有aur / python2-kivy-git.

当我试图安装aur / python2-kivy时,我得到了

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 = 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

我怎样才能使它工作?

解决方法:

这是Cython版本0.21和旧代码的问题.最简单的解决方案是将Cython降级到0.20,这是有效的.

要使用较新的Cython,请删除下载的pyjnius并让buildozer下载最新版本:

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

但是较新的Cython还需要更新的Kivy代码.在你的buildozer.spec中,将需求中的kivy更改为kivy == master以获取最新的Kivy代码.

标签:android,python-2-7,kivy,archlinux

来源: https://codeday.me/bug/20190528/1172648.html

 类似资料: