kivy / buildozer

Generic Python packager for Android and iOS
https://buildozer.readthedocs.io
MIT License
1.76k stars 504 forks source link

Error compiling Cython file #1769

Closed AHiXilTOr closed 9 months ago

AHiXilTOr commented 10 months ago

Versions

buildozer.spec

Command:

buildozer android debug

Spec file:

[app]
title = testapp
package.name = testapp
package.domain = com.testapp
source.dir = .
source.include_exts = py,png,jpg,kv,ini
source.exclude_dirs = bin, venv, .buildozer, .git, .github, server, .vscode
version.regex = __version__ = ['"](.*)['"]
version.filename = %(source.dir)s/main.py
requirements = python3==3.8.0, hostpython3==3.8.0, kivy, kivymd==1.1.1, exceptiongroup, typing_extensions, certifi, idna, h11==0.13, sniffio, anyio, httpcore, httpx

presplash.filename = %(source.dir)s/app/presplash.png
android.presplash_color = silver
icon.filename = %(source.dir)s/app/icon.png
orientation = portrait
fullscreen = 0

log_level = 2

android.archs = armeabi-v7a

properties)
android.permissions = android.permission.INTERNET

android.api = 34
android.minapi = 21

Logs

  RAN: /usr/bin/python3 '-cimport sys; from Cython.Compiler.Main import setuptools_main; sys.exit(setuptools_main());' ./kivy/core/image/_img_sdl2.pyx

  STDOUT:
/home/user/.local/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /github/workspace/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/kivy/armeabi-v7a__ndk_target_21/kivy/kivy/core/image/_img_sdl2.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...
    size_t(* read) ( SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
    size_t(* write) (SDL_RWops * context, void *ptr,size_t size, size_t num)
    int (* close) (SDL_RWops * context)

cdef size_t rwops_bytesio_write(SDL_RWops *context, const void *ptr, size_t size, size_t num) noexcept:
                                                                                             ^
------------------------------------------------------------

kivy/core/image/_img_sdl2.pyx:17:94: Syntax error in C variable declaration
xxxkvastarasxxx commented 9 months ago

I have similar one, when u got a solution, would u mention me pls

AHiXilTOr commented 9 months ago

@xxxkvastarasxxx requirements = Cython==0.29.33 p4a.branch = release-2022.12.20

xxxkvastarasxxx commented 9 months ago

That is what I have in my buildozer.spec file

title = Test App package.name = testapp1

package.domain = org.test source.dir = .

source.include_exts = py,png,jpg,kv,atlas,data,ep,ico source.branch = release-2022.12.20

version = 0.1

requirements = python3==3.7.6,hostpython3==3.7.6,cython==0.29.33,kivy,kivymd==1.1.1,pillow

presplash.filename = %(source.dir)s/data/presplash.jpg icon.filename = %(source.dir)s/data/icon.ico

orientation = portrait

osx.python_version = 3.7.6 osx.kivy_version = 1.9.1

fullscreen = 1

android.permissions = android.permission.INTERNET,android.permission.WRITE_EXTERNAL_STORAGE,android.permission.READ_EXTERNAL_STORAGE

And the message that appears after compilling. As you can see, I have added the cython version and the branch and still have a problem. Any other recommendations or advices. Would be grateful!!!

RAN: /usr/bin/python3 '-cimport sys; from Cython.Compiler.Main import setuptools_main; sys.exit(setuptools_main());' ./kivy/core/image/_img_sdl2.pyx

STDOUT: /home/user/.local/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /github/workspace/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/kivy/arm64-v8a__ndk_target_21/kivy/kivy/core/image/_img_sdl2.pyx tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:

... size_t( read) ( SDL_RWops context, void ptr, size_t size, size_t maxnum) size_t( write) (SDL_RWops context, void ptr,size_t size, size_t num) int ( close) (SDL_RWops context)

cdef size_t rwops_bytesio_write(SDL_RWops context, const void ptr, size_t size, size_t num) noexcept: ^

kivy/core/image/_img_sdl2.pyx:17:94: Syntax error in C variable declaration

AHiXilTOr commented 9 months ago

@xxxkvastarasxxx source.branch = release-2022.12.20 \|/ p4a.branch = release-2022.12.20

xxxkvastarasxxx commented 9 months ago

@xxxkvastarasxxx

source.branch = release-2022.12.20

\|/

p4a.branch = release-2022.12.20

thanks, it was my bad!

willcharlton commented 9 months ago

I ran into the same issue and the proposed fix worked for me. Though I can now build the APK, when it runs on device it crashes and shows log:

01-31 15:39:59.534 14315 14348 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
01-31 15:39:59.600 14315 14348 I python  :  Traceback (most recent call last):
01-31 15:39:59.600 14315 14348 I python  :    File "/github/workspace/.buildozer/android/app/main.py", line 8, in <module>
01-31 15:39:59.601 14315 14348 I python  :    File "/github/workspace/.buildozer/android/platform/build-armeabi-v7a_arm64-v8a/build/python-installs/project/arm64-v8a/kivymd/__init__.py", line 34, in <module>
01-31 15:39:59.601 14315 14348 I python  :    File "/github/workspace/.buildozer/android/platform/build-armeabi-v7a_arm64-v8a/build/python-installs/project/arm64-v8a/kivy/__init__.py", line 130, in require
01-31 15:39:59.601 14315 14348 I python  :  Exception: The version of Kivy installed on this system is too old. (You have 2.1.0, but the application requires 2.2.0)
01-31 15:39:59.601 14315 14348 I python  : Python for android ended.

Is this as simple as specifying requirements = kivy==2.1.0,... in buildozer.spec?

Edit: Fix was to pin kivy==2.2.0 in my case.