gpt4 book ai didi

python - 在 buildozer 中编译 Cython 文件时出错

转载 作者:行者123 更新时间:2023-12-01 09:22:51 27 4
gpt4 key购买 nike

我使用 kivy 构建了一个 Android 应用程序,当我使用 buildozer 编译它以构建 apk 时,弹出了以下错误;

[INFO]:    -> directory context /home/himanshu/helplineapp/.buildozer/android/platform/build/build/other_builds/pyjnius-python2-sdl2/armeabi-v7a/pyjnius
[INFO]: -> running python.host -c import sys; print(sys.path)
working: ['', '/home/himanshu/helplineapp/.buildozer/android/platform/build/build/python-instal[INFO]: Trying first build of pyjnius to get cython files: this is expected to fail
[INFO]: -> running python.host setup.py build_ext -v
('cwd is', '/home/himanshu/helplineapp/.buildozer/android/platform/build/build/other_builds/pyjnius-python2-sdl2/armeabi-v7a/pyjnius')
working: #error Do not use this file, it is the result of a failed Cython compilatiException in thread background thread for pid 3379:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 2455, in background_thread
handle_exit_code(exit_code)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 2153, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
ErrorReturnCode_1:

RAN: /home/himanshu/helplineapp/.buildozer/android/platform/build/build/python-installs/myapp/bin/python.host setup.py build_ext -v

STDOUT:
/home/himanshu/helplineapp/.buildozer/android/platform/build/build/python-installs/myapp/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running build_ext
building 'jnius' extension
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/himanshu/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -isysroot /home/himanshu/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -I/home/himanshu/helplineapp/.buildozer/android/platform/build/build/python-installs/myapp/include/python2.7 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/himanshu/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -isysroot /home/himanshu/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -I/home/himanshu/helplineapp/.buildozer/android/platform/build/build/python-installs/myapp/include/python2.7 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -I/home/himanshu/helplineapp/.buildozer/android/platform/build/build/python-installs/myapp/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 '/usr/bin/ccache' failed with exit status 1


STDERR:


[INFO]: pyjnius first build failed (as expected)
[INFO]: Running cython where appropriate
[INFO]: Cythonize jnius/jnius.pyx
[INFO]: -> running cython ./jnius/jnius.pyx
()
working: for interface in getattr(value, '__javainterfaces__', []): Exception in thread background thread for pid 3389:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 2455, in background_thread
handle_exit_code(exit_code)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 2153, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
ErrorReturnCode_1:

RAN: /usr/local/bin/cython ./jnius/jnius.pyx

STDOUT:

Error compiling Cython file:
------------------------------------------------------------
...
if jcs is not None:
obj = jcs.j_cls

if NULL == obj:
for interface in getattr(value, '__javainterfaces__', []):
obj = j_env[0].FindClass(j_env, str_for_c(interface))
^
------------------------------------------------------------

jnius/jnius_export_class.pxi:133:57: Obtaining 'char *' from temporary Python value


STDERR:


Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/himanshu/helplineapp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 978, in <module>
main()
File "/home/himanshu/helplineapp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 975, in main
ToolchainCL()
File "/home/himanshu/helplineapp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 512, in __init__
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/home/himanshu/helplineapp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 149, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/himanshu/helplineapp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
build_recipes(build_order, python_modules, ctx)
File "pythonforandroid/build.py", line 573, in build_recipes
File "pythonforandroid/recipe.py", line 928, in build_arch
File "pythonforandroid/recipe.py", line 963, in build_cython_components
File "pythonforandroid/recipe.py", line 1008, in cythonize_build
File "pythonforandroid/recipe.py", line 999, in cythonize_file
File "pythonforandroid/logger.py", line 175, in shprint
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 863, in next
self.wait()
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 792, in wait
self.handle_command_exit_code(exit_code)
File "/home/himanshu/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:

RAN: /usr/local/bin/cython ./jnius/jnius.pyx

STDOUT:

Error compiling Cython file:
------------------------------------------------------------
...
if jcs is not None:
obj = jcs.j_cls

if NULL == obj:
for interface in getattr(value, '__javainterfaces__', []):
obj = j_env[0].FindClass(j_env, str_for_c(interface))
^
------------------------------------------------------------

jnius/jnius_export_class.pxi:133:57: Obtaining 'char *' from temporary Python value


STDERR:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/himanshu/helplineapp/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

我知道最新版本的 cython 有一些问题,所以我降级到 cython==0.20 但没有运气,仍然是同样的错误。我已经通过降级 cython 使用 buildozer 编译了另外两个程序,但现在,在这种情况下,我不知道发生了什么。这里的一些其他答案说,在 buildozer.spec 文件中提高日志级别 2 将澄清错误的详细信息,但我是 buildozer 的新手。我不知道该怎么做。

此外,这个过程在下载 SDK 工具时花费的时间太长,因此我的资源有限。我恳请您帮助我消除这个错误。

提前致谢!

最佳答案

关于 cython 版本,我有一些非常相似的东西。我只设法让我的 buildozer 与 cython 0.23 一起工作。我花了很多小时并重新安装了很多次才解决这个问题......

也许可以尝试一下 cython 0.23。我个人可以确认它可以与 buildozer 0.34.dev0 一起使用。

关于python - 在 buildozer 中编译 Cython 文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50683450/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com