Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8093

Other • Re: RaspberryPi 4 buildroot Kivy package cross-compile errors

$
0
0
I've managed to get it working after some more tinkering. Not all of the select dependencies are required in the Config if you for example don't need X11. Here's the Config.in and .mk file I've ended up with, which work well for my setup.

Also, I needed to add the python-filetype package, but thankfully scanpypi handled that smoothly.

Config.in

Code:

config BR2_PACKAGE_PYTHON_KIVYbool "python-kivy"depends on BR2_TOOLCHAIN_USES_GLIBCselect BR2_PACKAGE_SDL2select BR2_PACKAGE_SDL2_IMAGEselect BR2_PACKAGE_SDL2_MIXERselect BR2_PACKAGE_SDL2_TTFselect BR2_PACKAGE_SDL2_X11select BR2_PACKAGE_LIBPNG # runtimeselect BR2_PACKAGE_MTDEV # runtimeselect BR2_PACKAGE_PYTHON_DOCUTILS # runtimeselect BR2_PACKAGE_PYTHON_PYGMENTS # runtimeselect BR2_PACKAGE_PYTHON_FILETYPEselect BR2_PACKAGE_RPI_USERLAND # GL driversselect BR2_PACKAGE_SDL2_OPENGL  # OpenGL supportselect BR2_PACKAGE_SDL2_OPENGLES  # OpenGLES supportselect BR2_PACKAGE_SDL2_KMSDRMselect BR2_PACKAGE_MESA3Dselect BR2_PACKAGE_MESA3D_OPENGL_ESselect BR2_PACKAGE_MESA3D_OPENGL_EGLselect BR2_PACKAGE_MESA3D_OPENGL_GLXselect BR2_PACKAGE_XORG7select BR2_PACKAGE_XLIB_LIBXRENDERhelp  A software library for rapid development of  hardware-accelerated multitouch applications.  http://kivy.orgcomment "python-kivy needs a glibc toolchain"depends on !BR2_TOOLCHAIN_USES_GLIBC
python-kivy.mk

Code:

################################################################################## python-kivy#################################################################################PYTHON_KIVY_VERSION = 2.3.1PYTHON_KIVY_SITE = $(call github,kivy,kivy,$(PYTHON_KIVY_VERSION))PYTHON_KIVY_SETUP_TYPE = setuptoolsPYTHON_KIVY_LICENSE = MITPYTHON_KIVY_LICENSE_FILES = LICENSE# Dependencies including host Python build tools and target libsPYTHON_KIVY_DEPENDENCIES = \host-python-cython \host-python-wheel \host-python-setuptools \rpi-userland \sdl2 sdl2_image sdl2_mixer sdl2_ttf \libgl libgles mesa3d \libegl xlib_libX11 xlib_libXrender \python-filetype# Environment variables for cross-compiling, avoiding host/target confusionPYTHON_KIVY_ENV += \KIVY_CROSS_PLATFORM=rpi \KIVY_CROSS_SYSROOT=$(STAGING_DIR) \CROSS_COMPILE=1 \PYTHONNOUSERSITE=1 \USE_SDL2=1 \USE_OPENGL_MOCK=0 \USE_OPENGL_ES2=1 \USE_EGL=0 \USE_MESAGL=0 \USE_X11=1 \USE_PANGOFT2=0 \KIVY_SDL2_PATH=$(STAGING_DIR)/usr/include/SDL2# Add patch to fix cross-compile sysconfig errorPYTHON_KIVY_PATCHES = python-kivy-build-deps.patch# Remove kivy examples to reduce target sizedefine PYTHON_KIVY_REMOVE_EXAMPLESrm -rf $(TARGET_DIR)/usr/share/kivy-examplesendefPYTHON_KIVY_POST_INSTALL_TARGET_HOOKS += PYTHON_KIVY_REMOVE_EXAMPLES$(eval $(python-package))
Turns out this line was what caused the build error described in my post:

Code:

PYTHONPATH=$(HOST_DIR)/lib/python3.12/site-packages
Hope this helps someone else trying to get Kivy running on Buildroot.

Statistics: Posted by mkolender — Tue Jul 29, 2025 6:09 pm



Viewing all articles
Browse latest Browse all 8093

Trending Articles