Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build "Hello World" APK #687

Closed
theflashbacker opened this issue Jun 28, 2018 · 15 comments
Closed

Cannot build "Hello World" APK #687

theflashbacker opened this issue Jun 28, 2018 · 15 comments

Comments

@theflashbacker
Copy link

Hello,
I am a Kivy and Buildozer newbie, so I had to solve a lot of problems by looking on forums but unfortunately I can't find anything for this (hopefully last) problem:
Running macOS 10.12.6, Python 2.7.15, Kivy 1.10.0 installed with the latest dmg
During compilation, I get this error:

[INFO]:    Cythonize kivy/graphics/stencil_instructions.pyx
[INFO]:    -> running cython ./kivy/graphics/stencil_instructions.pyx
[INFO]:    Cythonize kivy/graphics/svg.pyx
[INFO]:    -> running cython ./kivy/graphics/svg.pyx
           working: kivy/graphics/instructions.pxd:36:20: Prev...(and 24 more) Exception in thread background thread for pid 70737:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_1: 

  RAN: /usr/local/bin/cython ./kivy/graphics/svg.pyx

  STDOUT:

Error compiling Cython file:
------------------------------------------------------------
...
                end = time()
                Logger.debug("Svg: Loaded {} in {:.2f}s".format(filename, end - start))
            finally:
                fd.close()

    cdef void reload(self) except *:
        ^
------------------------------------------------------------

kivy/graphics/svg.pyx:469:9: Signature not compatible with previous declaration

Error compiling Cython file:
------------------------------------------------------------
...
        cpdef flag_update(self, int do_parent=?, list _instrs=?)
    ELSE:
        cpdef flag_update(self, int do_parent=?)
    cdef void flag_update_done(self)
    cdef void set_parent(self, Instruction parent)
    cdef void reload(self)
                   ^
------------------------------------------------------------

kivy/graphics/instructions.pxd:36:20: Previous declaration is here


  STDERR:


Traceback (most recent call last):                                             
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 978, in <module>
    main()
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.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 "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/recipes/kivy/__init__.py", line 18, in cythonize_build
    super(KivyRecipe, self).cythonize_build(env, build_dir=build_dir)
  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 "/usr/local/lib/python2.7/site-packages/sh.py", line 720, in next
    self.wait()
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /usr/local/bin/cython ./kivy/graphics/svg.pyx

  STDOUT:

Error compiling Cython file:
------------------------------------------------------------
...
                end = time()
                Logger.debug("Svg: Loaded {} in {:.2f}s".format(filename, end - start))
            finally:
                fd.close()

    cdef void reload(self) except *:
        ^
------------------------------------------------------------

kivy/graphics/svg.pyx:469:9: Signature not compatible with previous declaration

Error compiling Cython file:
------------------------------------------------------------
...
        cpdef flag_update(self, int do_parent=?, list _instrs=?)
    ELSE:
        cpdef flag_update(self, int do_parent=?)
    cdef void flag_update_done(self)
    cdef void set_parent(self, Instruction parent)
    cdef void reload(self)
                   ^
------------------------------------------------------------

kivy/graphics/instructions.pxd:36:20: Previous declaration is here


  STDERR:

# Command failed: /usr/local/opt/python@2/bin/python2.7 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.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

I've tried to downgrade to several Cython versions as I could read in several places, it didnt work.
I also have a strange behaviour with kivy, maybe it's related:
If I drag and drop the "hello world" example on the apps, it works fine, but if I try to start it from terminal, kivy starts well with:

kivy
import kivy

but when I want to start the example, I get this error:

>>> kivy main.py
   File "<stdin>", line 1
     kivy main.py
             ^
 SyntaxError: invalid syntax
>>> 

I am really out of idea, any suggestion is really welcome.
Also I just noticed that kivy -V returns python 2.7.10 while python -V returns 2.7.15
Could this be a problem?

Thanks a lot

@AndreMiras
Copy link
Member

Ouch, but what are you trying to do? I'm a bit lost I have to say.
What do you use buildozer for? You're trying to build you app for Android? Can you share the buildozer command you used?
And then you try to run from the python shell typing kivy main.py? That doesn't really make sense to be honest. In a Python shell we only write Python code. To run your program you should do it from a normal shell with python main.py.
Perhaps the issue tracker is not the best place to discuss these issues, try the kivy user group or IRC.

@theflashbacker theflashbacker changed the title Cannot build Hello Worl APK Cannot build "Hello World" APK Jun 28, 2018
@theflashbacker
Copy link
Author

Thanks for your quick answer and sorry I mixed a bit several issues because I thought it could be related. Let's focus on my 100% buildozer problem.
I'm trying to build an app for Android, for now just using the first kivy example to make sure i don't have code related problems.
I started with:

buildozer init

it creates successfully the specs files

then

buildozer android debug deploy run

which gave the error I reported in my post above (the first error)

I hope it's a bit more clear now :)

@inclement
Copy link
Member

This is an old error relating to the combination of cython and kivy versions used. I'm pretty sure it should be fixed in Kivy master and 1.10.1 - maybe try using kivy==1.10.1 in your requirements.

@theflashbacker
Copy link
Author

@inclement isn't 1.10.0 the latest version?
Anyway I tried your suggestion with kivy==1.10.1 and kivy==1.10.0 and I got the same error

@inclement
Copy link
Member

We're in the process of releasing 1.10.1. It's tagged on github, so should work here.

Did you clean the build before re-running buildozer? If you didn't, it won't have fetched a new Kivy version.

@theflashbacker
Copy link
Author

I runned it after cleaning and I got some similar errors, even though slightly different

[INFO]:    Building kivy for armeabi-v7a
[INFO]:    kivy apparently isn't already in site-packages
[INFO]:    Cythonizing anything necessary in kivy
[INFO]:    -> directory context /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/other_builds/kivy-python2-sdl2/armeabi-v7a/kivy
[INFO]:    -> running python.host -c import sys; print(sys.path)
[INFO]:    Trying first build of kivy to get cython files: this is expected to fail
[INFO]:    -> running python.host setup.py build_ext -v
('cwd is', '/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/other_builds/kivy-python2-sdl2/armeabi-v7a/kivy')
           working:  error: command 'arm-linux-androideabi-gcc...(and 27 more) Exception in thread background thread for pid 42368:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_1: 

  RAN: /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/python-installs/myapp/bin/python.host setup.py build_ext -v

  STDOUT:
Using distutils
Environ change use_sdl2 -> True

Cython check avoided.
Using this graphics system: OpenGL ES 2
WARNING: A problem occurred while running pkg-config --libs --cflags sdl2 SDL2_ttf SDL2_image SDL2_mixer (code 127)

/bin/sh: pkg-config: command not found


SDL2: found SDL header at /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL/include/SDL.h
SDL2: found SDL_mixer header at /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_mixer/SDL_mixer.h
SDL2: found SDL_ttf header at /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_ttf/SDL_ttf.h
SDL2: found SDL_image header at /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_image/SDL_image.h
fatal: Not a git repository (or any of the parent directories): .git
 /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/python-installs/myapp/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'extra_requires'
   warnings.warn(msg)
 /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/python-installs/myapp/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'setup_requires'
   warnings.warn(msg)
 /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/python-installs/myapp/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'dependency_links'
   warnings.warn(msg)
 /Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.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
Build configuration is:
 * use_rpi = 0
 * use_mali = 0
 * use_egl = 0
 * use_opengl_es2 = 1
 * use_opengl_mock = 0
 * use_sdl2 = 1
 * use_ios = 0
 * use_mesagl = 0
 * use_x11 = 0
 * use_wayland = 0
 * use_gstreamer = 0
 * use_avfoundation = 0
 * use_osx_frameworks = 0
 * debug_gl = 0
 * debug = False
Updated kivy/include/config.h
Updated kivy/include/config.pxi
Updated kivy/setupconfig.py
Detected compiler is unix
building 'kivy.core.text._text_sdl2' extension
creating build
creating build/temp.macosx-10.12-x86_64-2.7
creating build/temp.macosx-10.12-x86_64-2.7/kivy
creating build/temp.macosx-10.12-x86_64-2.7/kivy/core
creating build/temp.macosx-10.12-x86_64-2.7/kivy/core/text
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/Users/maximelethelier/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -isysroot /Users/maximelethelier/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -I/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.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/Users/maximelethelier/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -isysroot /Users/maximelethelier/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -I/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/python-installs/myapp/include/python2.7 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -Ikivy/include -I/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL/include -I/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_image -I/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_mixer -I/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_ttf -I/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/build/build/python-installs/myapp/include/python2.7 -c kivy/core/text/_text_sdl2.c -o build/temp.macosx-10.12-x86_64-2.7/kivy/core/text/_text_sdl2.o
arm-linux-androideabi-gcc: error: kivy/core/text/_text_sdl2.c: No such file or directory
arm-linux-androideabi-gcc: fatal error: no input files
compilation terminated.
 error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:


[INFO]:    kivy first build failed (as expected)                               
[INFO]:    Running cython where appropriate
[INFO]:    Cythonize kivy/_clock.pyx
[INFO]:    -> running cython ./kivy/_clock.pyx
[INFO]:    Cythonize kivy/_event.pyx
[INFO]:    -> running cython ./kivy/_event.pyx
[INFO]:    Cythonize kivy/properties.pyx
[INFO]:    -> running cython ./kivy/properties.pyx
[INFO]:    Cythonize kivy/weakproxy.pyx
[INFO]:    -> running cython ./kivy/weakproxy.pyx
[INFO]:    Cythonize kivy/core/audio/audio_sdl2.pyx
[INFO]:    -> running cython ./kivy/core/audio/audio_sdl2.pyx
[INFO]:    Cythonize kivy/core/camera/camera_avfoundation.pyx
[INFO]:    -> running cython ./kivy/core/camera/camer...(and 18 more)
[INFO]:    Cythonize kivy/core/clipboard/_clipboard_sdl2.pyx
[INFO]:    -> running cython ./kivy/core/clipboard/_clipboard_sdl2.pyx
[INFO]:    Cythonize kivy/core/image/_img_sdl2.pyx
[INFO]:    -> running cython ./kivy/core/image/_img_sdl2.pyx
[INFO]:    Cythonize kivy/core/image/img_imageio.pyx
[INFO]:    -> running cython ./kivy/core/image/img_imageio.pyx
()
[INFO]:    Cythonize kivy/core/text/_text_sdl2.pyx                             
[INFO]:    -> running cython ./kivy/core/text/_text_sdl2.pyx
[INFO]:    Cythonize kivy/core/text/text_layout.pyx
[INFO]:    -> running cython ./kivy/core/text/text_layout.pyx
[INFO]:    Cythonize kivy/core/window/_window_sdl2.pyx
[INFO]:    -> running cython ./kivy/core/window/_window_sdl2.pyx
[INFO]:    Cythonize kivy/core/window/window_info.pyx
[INFO]:    -> running cython ./kivy/core/window/window_info.pyx
[INFO]:    Cythonize kivy/core/window/window_x11.pyx
[INFO]:    -> running cython ./kivy/core/window/window_x11.pyx
           working: kivy/core/window/window_x11.pyx:221:41: '...(and 65 more)  Exception in thread background thread for pid 42425:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_1: 

  RAN: /usr/local/bin/cython ./kivy/core/window/window_x11.pyx

  STDOUT:

Error compiling Cython file:
------------------------------------------------------------
...
from kivy.config import Config
from kivy.base import stopTouchApp, EventLoop, ExceptionManager
from kivy.utils import platform
from os import environ

from window_info cimport WindowInfoX11
^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:18:0: 'kivy/core/window/window_info/WindowInfoX11.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
cdef extern int x11_create_window(int width, int height, int x, int y, \
        int resizable, int fullscreen, int border, int above, int CWOR, char *title)
cdef extern void x11_gl_swap()
cdef extern void x11_set_title(char *title)
cdef extern int x11_idle()
cdef extern Display *x11_get_display()
           ^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:69:12: 'Display' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        int resizable, int fullscreen, int border, int above, int CWOR, char *title)
cdef extern void x11_gl_swap()
cdef extern void x11_set_title(char *title)
cdef extern int x11_idle()
cdef extern Display *x11_get_display()
cdef extern Window x11_get_window()
           ^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:70:12: 'Window' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        self.system_size = size
        super(WindowX11, self).create_window()
        self._unbind_create_window()

    def get_window_info(self):
        cdef WindowInfoX11 window_info = WindowInfoX11()
            ^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:221:13: 'WindowInfoX11' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        self.system_size = size
        super(WindowX11, self).create_window()
        self._unbind_create_window()

    def get_window_info(self):
        cdef WindowInfoX11 window_info = WindowInfoX11()
                                        ^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:221:41: 'WindowInfoX11' is not a constant, variable or function identifier


  STDERR:


Traceback (most recent call last):                                             
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 978, in <module>
    main()
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.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 "/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/recipes/kivy/__init__.py", line 18, in cythonize_build
    super(KivyRecipe, self).cythonize_build(env, build_dir=build_dir)
  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 "/usr/local/lib/python2.7/site-packages/sh.py", line 720, in next
    self.wait()
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /usr/local/bin/cython ./kivy/core/window/window_x11.pyx

  STDOUT:

Error compiling Cython file:
------------------------------------------------------------
...
from kivy.config import Config
from kivy.base import stopTouchApp, EventLoop, ExceptionManager
from kivy.utils import platform
from os import environ

from window_info cimport WindowInfoX11
^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:18:0: 'kivy/core/window/window_info/WindowInfoX11.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
cdef extern int x11_create_window(int width, int height, int x, int y, \
        int resizable, int fullscreen, int border, int above, int CWOR, char *title)
cdef extern void x11_gl_swap()
cdef extern void x11_set_title(char *title)
cdef extern int x11_idle()
cdef extern Display *x11_get_display()
           ^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:69:12: 'Display' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        int resizable, int fullscreen, int border, int above, int CWOR, char *title)
cdef extern void x11_gl_swap()
cdef extern void x11_set_title(char *title)
cdef extern int x11_idle()
cdef extern Display *x11_get_display()
cdef extern Window x11_get_window()
           ^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:70:12: 'Window' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        self.system_size = size
        super(WindowX11, self).create_window()
        self._unbind_create_window()

    def get_window_info(self):
        cdef WindowInfoX11 window_info = WindowInfoX11()
            ^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:221:13: 'WindowInfoX11' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        self.system_size = size
        super(WindowX11, self).create_window()
        self._unbind_create_window()

    def get_window_info(self):
        cdef WindowInfoX11 window_info = WindowInfoX11()
                                        ^
------------------------------------------------------------

kivy/core/window/window_x11.pyx:221:41: 'WindowInfoX11' is not a constant, variable or function identifier


  STDERR:

# Command failed: /usr/local/opt/python@2/bin/python2.7 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy==1.10.1 --arch armeabi-v7a --copy-libs --color=always --storage-dir=/Users/maximelethelier/Projects/Extim/Python_mobile_app/kivytest/.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

@AndreMiras
Copy link
Member

Yes it's more clear now. And yes the error is different, thank you for sharing the log, without it nobody can help.
So now this error looks like this kivy/python-for-android#1259
What Cython version are you running? Can you share the pip freeze please?

@theflashbacker
Copy link
Author

After trying several versions of Cython, i'm now back on 0.28.3, after reading the issue you referred to, i tried with Cython 0.25, unsuccessfully.
pip freeze give:

appdirs==1.4.3
buildozer==0.34
colorama==0.3.9
Cython==0.25
Jinja2==2.10
MarkupSafe==1.0
pexpect==4.6.0
ptyprocess==0.6.0
pygame==1.9.3
pyOSC==0.3.5b5294
python-for-android==0.6.0
sh==1.12.4
six==1.11.0
virtualenv==16.0.0

@AndreMiras
Copy link
Member

OK then I have no clue, and since I'm not running OS X, I'm not sure I could really help.
Well I have a VM where I could give a try. So I'll try to see if I can reproduce to confirm this issue or if it's a "works for me".
In the meantime if you really want to have your hello world to build, you could give a try with Docker, see /~https://github.com/kivy/buildozer#buildozer-docker-image

@theflashbacker
Copy link
Author

ok thanks for your help, I'll try with Docker and have a look at the VM also

@AndreMiras
Copy link
Member

Yes I confirm that I could successfully build the a hell world APK in that VM.

OS:

system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 10.12.2 (16C67)
      Kernel Version: Darwin 16.3.0
      Boot Volume: vagrant-box-osx
      Boot Mode: Normal
      Computer Name: vagrant
      User Name: vagrant (vagrant)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 55 minutes

Cython version:

cython --version
Cython version 0.25.2

pip freeze:

pip freeze
appdirs==1.4.3
buildozer==0.34
colorama==0.3.9
Cython==0.25.2
Jinja2==2.10
MarkupSafe==1.0
pexpect==4.6.0
ptyprocess==0.5.2
sh==1.12.4
six==1.11.0
virtualenv==16.0.0

java -version`:

java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

So I would suggest you to start again from a clean build making sure you're on Cython==0.25.2.

@theflashbacker
Copy link
Author

I got the same error than before with Cython 0.25.2
I feel like there's some deeper problem in my kivy installation.
In the mean time I worked a bit on the VM and managed to build my APK from there. I think i'll work a bit on that for now.
Thanks for your help

@brentpicasso
Copy link
Contributor

I am seeing this issue as well, with the helloworld app and a fresh buildozer init.

When I have default kivy requirements in the buildozer.spec it builds successfully.

requirements = kivy

The build fails when I change it to 1.10.1

requirements = kivy==1.10

It fails with the common issue here:

    self.system_size = size
    super(WindowX11, self).create_window()
    self._unbind_create_window()

def get_window_info(self):
    cdef WindowInfoX11 window_info = WindowInfoX11()
        ^

kivy/core/window/window_x11.pyx:221:13: 'WindowInfoX11' is not a type identifier

subset of pip freeze (snipped others)

buildozer==0.34
Cython==0.25.2
Kivy==1.10.1
Kivy-Garden==0.1.4
kivy3==0.1
pygame===1.9.1release
python-for-android==0.6.0

@brentpicasso
Copy link
Contributor

With Cython 0.28.5 the problem still happens with a clean build (delete .buildozer).

On a lark I tried running buildozer again immediately right after the failure, and it somehow completed successfully.

So what seems to happen is:

perform clean build

Observe error

Immediately re-run the build (without cleaning)

Observe success

Hope this helps diagnose the eventual fix.

@inclement
Copy link
Member

Closing as stale, I believe this is fixed when using the various master branches and a recent cython

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants