Bug 4973 - runqemu: Could not initialize SDL(No available video device) for core-image-sato on Fedora 19
Summary: runqemu: Could not initialize SDL(No available video device) for core-image-...
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: High major
Target Milestone: 1.5 M4
Assignee: Kai Kang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-08-01 14:14 UTC by Stefan Stanacar
Modified: 2013-10-07 13:26 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
strace for the first runqemu - minimal image (726.18 KB, text/plain)
2013-08-13 12:38 UTC, Stefan Stanacar
no flags Details
strace for second runqemu - sato image (47.63 KB, text/plain)
2013-08-13 12:39 UTC, Stefan Stanacar
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Stanacar 2013-08-01 14:14:08 UTC
poky commit: 9de0ad47462c13ac4a2d73e12e92be6c1b4e0415

On my Fedora 19 system I'm unable to run qemu images if a bitbake core-image-sato. I do have libSDL-devel packages installed and the qemu binary does link to libSDL on my system. 
However if I bitbake core-image-minimal and run the minimal it does work, which is really wierd.
I tried with two clean build dirs, no sstate each time just to be sure.

WORKING:
 - start with a clean build dir (build1), no sstate:
$ bitbake core-image-minimal
Build Configuration:
BB_VERSION        = "1.19.1"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Fedora-19"
TARGET_SYS        = "x86_64-poky-linux"
MACHINE           = "qemux86-64"
DISTRO            = "poky"
DISTRO_VERSION    = "1.4+snapshot-20130801"
TUNE_FEATURES     = "m64"
TARGET_FPU        = ""
meta              
meta-yocto        
meta-yocto-bsp    = "master:9de0ad47462c13ac4a2d73e12e92be6c1b4e0415"

 
runqemu qemux86-64 core-image-minimal
Assuming core-image-minimal really means /mnt/back/yocto/poky/build/tmp/deploy/images/core-image-minimal-qemux86-64.ext3

Continuing with the following parameters:
KERNEL: [/mnt/back/yocto/poky/build/tmp/deploy/images/bzImage-qemux86-64.bin]
ROOTFS: [/mnt/back/yocto/poky/build/tmp/deploy/images/core-image-minimal-qemux86-64.ext3]
FSTYPE: [ext3]
Setting up tap interface under sudo
Acquiring lockfile for tap0...
Running qemu-system-x86_64...
/mnt/back/yocto/poky/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-x86_64 -kernel /mnt/back/yocto/poky/build/tmp/deploy/images/bzImage-qemux86-64.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -hda /mnt/back/yocto/poky/build/tmp/deploy/images/core-image-minimal-qemux86-64.ext3 -show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -m 128 --append "vga=0 uvesafb.mode_option=640x480-32 root=/dev/hda rw mem=128M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 "

$ ldd /mnt/back/yocto/poky/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-x86_64 | grep -i sdl
	libSDL-1.2.so.0 => /lib64/libSDL-1.2.so.0 (0x00007f6adebf8000)

NOT WORKING:
- start with another clean build dir (build2), no sstate

bitbake core-image-sato

runqemu qemux86-64 core-image-sato
Assuming core-image-sato really means /mnt/back/yocto/poky2/build/tmp/deploy/images/core-image-sato-qemux86-64.ext3

Continuing with the following parameters:
KERNEL: [/mnt/back/yocto/poky2/build/tmp/deploy/images/bzImage-qemux86-64.bin]
ROOTFS: [/mnt/back/yocto/poky2/build/tmp/deploy/images/core-image-sato-qemux86-64.ext3]
FSTYPE: [ext3]
Setting up tap interface under sudo
Acquiring lockfile for tap0...
Running qemu-system-x86_64...
/mnt/back/yocto/poky2/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-x86_64 -kernel /mnt/back/yocto/poky2/build/tmp/deploy/images/bzImage-qemux86-64.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -hda /mnt/back/yocto/poky2/build/tmp/deploy/images/core-image-sato-qemux86-64.ext3 -show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -m 128 --append "vga=0 uvesafb.mode_option=640x480-32 root=/dev/hda rw mem=128M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 "
Could not initialize SDL(No available video device) - exiting
Set 'tap0' nonpersistent
Releasing lockfile of preconfigured tap device 'tap0'

$ ldd /mnt/back/yocto/poky2/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-x86_64 |grep -i sdl
	libSDL-1.2.so.0 => /lib64/libSDL-1.2.so.0 (0x00007ff4c6b1b000)
Comment 1 Ross Burton 2013-08-02 07:50:35 UTC
At least you can replicate it on demand...  I'd suggest putting a strace in runqemu-internal so you can get a log from qemu when it works and when it doesn't, and then diffing then.
Comment 2 Stefan Stanacar 2013-08-13 12:38:47 UTC
Created attachment 1420 [details]
strace for the first runqemu - minimal image
Comment 3 Stefan Stanacar 2013-08-13 12:39:06 UTC
Created attachment 1421 [details]
strace for second runqemu  - sato image
Comment 4 Stefan Stanacar 2013-08-13 12:41:32 UTC
The first strace is longer because qemu actually starts there, I've stopped it as soon as I could. 
Also, if a bitbake core-image-sato in the build dir where I've built core-image-minimal, none of them will work anymore, I need to wipe tmp and rebuild minimal I want to boot the image.
Comment 5 Saul Wold 2013-08-14 03:02:10 UTC
Well I have looked into this a little further, this is going to be fun!  I put 
qemu under the debugger and the trigger that's causing it seems to be a memory 
corruption. I loaded the debuginfo for SDL and found that during the 
SDL_VideoInit-> SDL_X11_LoadSymbols(), the SDL_X11_HAVE_BASEXLIB seems to go 
from 1 to 0 and then a check later for BASEXLIB fails and causes our SDL Error.

The change occurs during the SDL_X11_SYM(...) linkage

I also installed the F19 qemu packages and ran the same and it worked correctly
Comment 6 Kai Kang 2013-08-16 08:07:53 UTC
after 'bitbake libxrandr-native', I can start qemu for qemux86 sato image. Double checking it.
Comment 7 Saul Wold 2013-08-21 03:36:31 UTC
I looked into this further and discovered that via the debugger, that when the 
SDL_X11_HAVE_BASEXLIB changes it's looking for the XMissingExtension() function 
in libXext, I am still not sure why, but it's not found with the system libXext.
Comment 8 Saul Wold 2013-08-21 04:18:04 UTC
BTW, I put a gdb "watch" on SDL_X11_HAVE_BASEXLIB and then set a break point in 
the SDL_LoadFunction (break if name="XMissingExtension"), and saw the dlsym's 
_dlerror_run() fail, I have not dug deeper yet.
Comment 9 Kai Kang 2013-08-21 09:11:50 UTC
When start qemu, it calls SDL_Init(), and finally calls SDL_LoadObject(). Then it calls dlopen to open 4 dynamic libraries: libX11.so.6, libXext.so.6, libXrender.so.1 and libXrandr.so.2. Unfortunately, it fails to dlopen libXext.so.6 then show sdl init failed.

There is a undefined symbol `_XEatDataWords' in library libXext.so.6 (/lib64/libXext.so.6) which should be provided by libX11.so. File tmp/sysroot/*-native/usr/lib/libX11.so.6 is searched first and used. As we know, it is from package libx11-native-1.5.0. And it doesn't provides symbol `_XEatDataWords'.

Symbol `_XEatDataWords' is from libx11 version 1.6.0 which version the Fedora 19 uses.

Update libx11 to latest version 1.6.1 to fix this problem.
Comment 11 Stefan Stanacar 2013-10-07 13:26:30 UTC
Marked as Verified.