Ошибка компиляции файла Cython в buildozer - PullRequest
0 голосов
/ 04 июня 2018

Я создал приложение для Android, используя kivy, и пока я компилировал его для сборки apk с помощью buildozer, выскочила следующая ошибка:

[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, но не повезло, все та же ошибка.Я уже скомпилировал еще две программы, используя buildozer, понизив версию Cython, но сейчас, в этом случае, я не знаю, что происходит.Некоторые другие ответы здесь говорят, что повышение уровня журнала 2 в файле buildozer.spec прояснит детали ошибки, но я новичок в buildozer.Я не знаю, как это сделать.

Кроме того, этот процесс занимает слишком много времени, пока он загружает инструменты SDK, и поэтому я ограничен в ресурсах.Я прошу смиренно, чтобы помочь мне избавиться от этой ошибки.

Заранее спасибо!

1 Ответ

0 голосов
/ 18 июня 2018

У меня было что-то очень похожее в отношении версий Cython.Мне только удалось заставить мой buildozer работать с Cython 0.23.Потребовалось много часов и много переустановок, чтобы понять это ...

Возможно, стоит попробовать Cython 0.23.Я могу лично подтвердить, что он работает с buildozer 0.34.dev0.

...