Skip to content

Operation only allowed in c++ when compiling with Buildozer #3107

Description

@kuzeyron

kivy/core/image/img_imageio.pyx seems to fail while building with the message Operation only allowed in c++.
Branch: develop
Platform: Linux

img_imageio.pyx should not try to be compiled on Linux.

Part of the log:

[DEBUG]:        kivy/core/image/img_imageio.pyx:333:8: Operation only allowed in c++
Exception in thread background thread for pid 126603:
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/home/kuzeyron/Projects/SafeUpload/.venv/lib/python3.12/site-packages/sh.py", line 1641, in wrap
    fn(*rgs, **kwargs)
  File "/home/kuzeyron/Projects/SafeUpload/.venv/lib/python3.12/site-packages/sh.py", line 2569, in background_thread
    handle_exit_code(exit_code)
  File "/home/kuzeyron/Projects/SafeUpload/.venv/lib/python3.12/site-packages/sh.py", line 2269, in fn
    return self.command.handle_command_exit_code(exit_code)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kuzeyron/Projects/SafeUpload/.venv/lib/python3.12/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/kuzeyron/Projects/SafeUpload/.venv/bin/python3 '-cimport sys; from Cython.Compiler.Main import setuptools_main; sys.exit(setuptools_main());' ./kivy/core/image/img_imageio.pyx

  STDOUT:
/home/kuzeyron/Projects/SafeUpload/.venv/lib/python3.12/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/kivy/arm64-v8a__ndk_target_21/kivy/kivy/core/image/img_imageio.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
performance hint: kivy/core/image/img_imageio.pyx:175:5: Exception check on 'c_load_image_data' will always require the GIL to be acquired.
Possible solutions:
        1. Declare 'c_load_image_data' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
        2. Use an 'int' return type on 'c_load_image_data' to allow an error code to be returned.

Error compiling Cython file:
------------------------------------------------------------
...

cdef class _ImageIOInterface:
    cdef KivyImageIOProvider* _provider

    def __cinit__(self):
        self._provider = new KivyImageIOProvider()
                         ^
------------------------------------------------------------

kivy/core/image/img_imageio.pyx:330:25: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...

    def __cinit__(self):
        self._provider = new KivyImageIOProvider()

    def __dealloc__(self):
        del self._provider
        ^
------------------------------------------------------------

kivy/core/image/img_imageio.pyx:333:8: Operation only allowed in c++


  STDERR:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1256, in <module>
    main()
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 685, in __init__
    getattr(self, command)(args)
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 104, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 163, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx,
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 504, in build_recipes
    recipe.build_arch(arch)
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 1031, in build_arch
    self.build_cython_components(arch)
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 1056, in build_cython_components
    self.cythonize_build(env=env)
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/kivy/__init__.py", line 38, in cythonize_build
    super().cythonize_build(env, build_dir=build_dir)
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 1104, in cythonize_build
    self.cythonize_file(env, build_dir, join(root, filename))
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/kivy/__init__.py", line 59, in cythonize_file
    super().cythonize_file(env, build_dir, filename)
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 1093, in cythonize_file
    shprint(python_command, "-c"
  File "/home/kuzeyron/Projects/SafeUpload/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
                ^^^^^^
  File "/home/kuzeyron/Projects/SafeUpload/.venv/lib/python3.12/site-packages/sh.py", line 915, in next
    self.wait()
  File "/home/kuzeyron/Projects/SafeUpload/.venv/lib/python3.12/site-packages/sh.py", line 845, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/kuzeyron/Projects/SafeUpload/.venv/lib/python3.12/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions