hostpython2构建错误(适用于使用Kivy的Android)

时间:2019-01-21 12:59:05

标签: android python kivy buildozer

我遇到以下错误

[INFO]:    # Building recipes
[INFO]:    Building hostpython2 for armeabi-v7a
[INFO]:    -> directory context /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2
[INFO]:    -> directory context /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build
[INFO]:    <- directory context /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2
[INFO]:    -> running cp Modules/Setup.dist /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build/Modules/Setup
[INFO]:    -> running make -C /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build
Exception in thread background thread for pid 23429:                                                                                                                                                       
Traceback (most recent call last):
  File "/home/peter/Conda/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/peter/Conda/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/peter/Conda/lib/python3.6/site-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/home/peter/Conda/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/home/peter/Conda/lib/python3.6/site-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/peter/Conda/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_2: 

  RAN: /usr/bin/make -C /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build

  STDOUT:
make: Entering directory '/home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build'
/bin/sh /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Modules/makesetup -c /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Modules/config.c.in \
            -s Modules \
            Modules/Setup.config \
            Modules/Setup.local \
            Modules/Setup
The Makefile was updated, you may need to re-run make.
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes   Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/parsetok.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/pgenmain.o -lpthread -ldl  -lutil -o Parser/pgen
gcc: error: Parser/tokenizer_pgen.o: No such file or directory
gcc: error: Parser/printgrammar.o: No such file or directory
gcc: error: Parser/pgenmain.o: No such file or directory
Makefile:566: recipe for target 'Parser/pgen' failed
make: *** [Parser/pgen] Error 1
make: Leaving directory '/home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build'


  STDERR:


Traceback (most recent call last):
  File "/home/peter/Conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/peter/Conda/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/peter/Documents/testapp/app/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 1039, in <module>
    main()
  File "/home/peter/Documents/testapp/app/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 1033, in main
    ToolchainCL()
  File "/home/peter/Documents/testapp/app/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 553, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/peter/Documents/testapp/app/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 150, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/peter/Documents/testapp/app/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 191, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/home/peter/Documents/testapp/app/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/build.py", line 634, in build_recipes
    recipe.build_arch(arch)
  File "/home/peter/Documents/testapp/app/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/python.py", line 382, in build_arch
    result = shprint(sh.make, '-C', build_dir)
  File "/home/peter/Documents/testapp/app/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/logger.py", line 178, in shprint
    for line in output:
  File "/home/peter/Conda/lib/python3.6/site-packages/sh.py", line 863, in next
    self.wait()
  File "/home/peter/Conda/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/peter/Conda/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_2: 

  RAN: /usr/bin/make -C /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build

  STDOUT:
make: Entering directory '/home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build'
/bin/sh /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Modules/makesetup -c /home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Modules/config.c.in \
            -s Modules \
            Modules/Setup.config \
            Modules/Setup.local \
            Modules/Setup
The Makefile was updated, you may need to re-run make.
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes   Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/parsetok.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/pgenmain.o -lpthread -ldl  -lutil -o Parser/pgen
gcc: error: Parser/tokenizer_pgen.o: No such file or directory
gcc: error: Parser/printgrammar.o: No such file or directory
gcc: error: Parser/pgenmain.o: No such file or directory
Makefile:566: recipe for target 'Parser/pgen' failed
make: *** [Parser/pgen] Error 1
make: Leaving directory '/home/peter/Documents/testapp/app/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build'


  STDERR:

# Command failed: /home/peter/Conda/bin/python -m pythonforandroid.toolchain create --dist_name=kivy_hello_world --bootstrap=sdl2 --requirements=kivy,numpy --ndk-api 9 --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/peter/Documents/testapp/app/.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

我用Google搜索它,发现这可能是旧编译尝试遗留下来的结果。这就是为什么我使用

buildozer distclean

摆脱旧的编译数据。不幸的是,这没有改变,错误仍然存​​在。在构建期间,我唯一的要求是Kivy和NumPy-都列在我的.spec文件中。显然,该过程需要分别安装构建hostpython2,这导致上面显示的错误。

建立Kivy应该不是问题,但NumPy可能是...我使用了buildozer回购中的“官方”配方。我尝试通过pip安装pgen,但我真的不知道自己在做什么-只是尝试。

目标平台是Android。

1 个答案:

答案 0 :(得分:0)

buildozer distcleanbuildozer clean都不起作用,因此我删除了〜/ .buildozer和./.buildozer目录。那解决了问题。