Skip to contentSkip to conversation

libsdl: enable X11 for nativesdk

PATCH New Martin Kelly 1 participant 1 message Apr 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsdl: enable X11 for nativesdk

From: Martin Kelly <[email protected]>

Currently, the following situation fails:

- Build an SDK and image. Make the image support graphics but not X11.
- Extract SDK and copy image somewhere outside of the Yocto workspace. Do runqemu on the image.

This results in the error:
"Could not initialize SDL(No available video device) - exiting"

This error occurs because libSDL attempts to load libX11 for video devices. When it fails, qemu also fails.

Note that the same runqemu command will work fine from within the Yocto workspace environment because it will use the native libSDL -- which supports X11 -- rather than the nativesdk libSDL. In addition, the command will work fine as long as DISTRO_FEATURES includes x11, because then the nativesdk libSDL will be compiled with X11 support.

Although the example above may seem a bit silly, this is actually a pretty bad error because it breaks the ability to build an SDK and image on one machine and run it on a different machine.

Fix the issue by building nativesdk-libsdl with X11 support -- even when DISTRO_FEATURES does not include X11 -- as we already do for libsdl-native.

---
 meta/recipes-graphics/libsdl/libsdl_1.2.15.bb      | 3 ++-
 meta/recipes-graphics/xorg-lib/libxcb_1.12.bb      | 1 +
 meta/recipes-graphics/xorg-lib/xorg-lib-common.inc | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)
meta/recipes-graphics/libsdl/libsdl_1.2.15.bb +2 -1
index c802a6f..89d84ab 100644
@@ -43,8 +43,9 @@ EXTRA_OECONF = "--disable-static --enable-cdrom --enable-threads --enable-timers
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio x11', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'opengl', '', d)}"
+# Without X11 support, qemu will fail because SDL cannot find video devices.
 PACKAGECONFIG_class-native = "x11"
-PACKAGECONFIG_class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
+PACKAGECONFIG_class-nativesdk = "x11"
 
 PACKAGECONFIG[alsa] = "--enable-alsa --disable-alsatest,--disable-alsa,alsa-lib"
 PACKAGECONFIG[pulseaudio] = "--enable-pulseaudio,--disable-pulseaudio,pulseaudio"
meta/recipes-graphics/xorg-lib/libxcb_1.12.bb +1 -0
index a38bdea..6d7e675 100644
@@ -31,6 +31,7 @@ inherit autotools pkgconfig distro_features_check
 # The libxau and others requires x11 in DISTRO_FEATURES
 REQUIRED_DISTRO_FEATURES = "x11"
 REQUIRED_DISTRO_FEATURES_class-native = ""
+REQUIRED_DISTRO_FEATURES_class-nativesdk = ""
 
 export PYTHON = "python3"
 
meta/recipes-graphics/xorg-lib/xorg-lib-common.inc +1 -0
index 6f4e444..b397923 100644
@@ -25,3 +25,4 @@ UNKNOWN_CONFIGURE_WHITELIST += "--enable-malloc0returnsnull --disable-malloc0ret
 
 REQUIRED_DISTRO_FEATURES ?= "x11"
 REQUIRED_DISTRO_FEATURES_class-native = ""
+REQUIRED_DISTRO_FEATURES_class-nativesdk = ""
Signature · 1 line
2.1.4