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

Error compiling Cython file #1769

Closed
AHiXilTOr opened this issue Jan 30, 2024 · 6 comments
Closed

Error compiling Cython file #1769

AHiXilTOr opened this issue Jan 30, 2024 · 6 comments

Comments

@AHiXilTOr
Copy link

Versions

  • Python: 3.8.0
  • OS: Linux
  • Buildozer: latest

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
Copy link

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

@AHiXilTOr
Copy link
Author

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

@xxxkvastarasxxx
Copy link

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
Copy link
Author

AHiXilTOr commented Jan 31, 2024

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

@xxxkvastarasxxx
Copy link

@xxxkvastarasxxx

source.branch = release-2022.12.20

\|/

p4a.branch = release-2022.12.20

thanks, it was my bad!

@willcharlton
Copy link

willcharlton commented Jan 31, 2024

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.

@AHiXilTOr AHiXilTOr reopened this Feb 1, 2024
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

3 participants