Bug 8409

Summary: qemu fails to build on headless system
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Daniel Golle <dgolle>
Component: devtools / tool chainAssignee: Daniel Golle <dgolle>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher, poky.bs.watcher, poky.watcher, ross.burton
Version: 1.8   
Target Milestone: 1.8.2   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Daniel Golle 2015-09-28 16:52:35 UTC
qemu pulls in libGLU which fails to locate liubGL.so.
This is due to mesa only providing libGL is DISTRO_FEATURES 'x11' is set.
However, on headless systems (think: edgerouter-lite) it doesn't make sense to build with x11 (nor libGL or mesa, but nvm), yet qemu/kvm is usefull on these systems for headless VM images (qemu --nographic ...).
Possible solutions:
* build qemu without SDL, x11, ... depending on DISTRO_FEATURES
* make sure qemu doesn't depend on libGLU
* make sure mesa actually provides libGL even on systems without x11

The first solution isn't that great because it also prevents using VNC or SPICE remotely.
Comment 1 Ross Burton 2015-10-01 13:08:48 UTC
"* make sure mesa actually provides libGL even on systems without x11" doesn't make any sense - libGL.so is explicitly bound to libX11 (its the GLX API).

Are you sure that qemu won't do VNC/SPICE when SDL is disabled?  I'm sure I've ran it headless with a VNC connection in the past.
Comment 2 Ross Burton 2015-10-01 13:55:13 UTC
Qemu doesn't need X11 nor SDL for VNC to work:

$ runqemu qemux86
[...]
VNC server running on `::1:5900'

$ ldd /data/poky-master/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386
	linux-vdso.so.1 (0x00007ffef3297000)
	libz.so.1 => /data/poky-master/tmp/sysroots/x86_64-linux/usr/bin/../lib/libz.so.1 (0x00007f4557f17000)
	libpixman-1.so.0 => /data/poky-master/tmp/sysroots/x86_64-linux/usr/bin/../lib/libpixman-1.so.0 (0x00007f4557c6c000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f4557a69000)
	libasound.so.2 => /data/poky-master/tmp/sysroots/x86_64-linux/usr/bin/../lib/libasound.so.2 (0x00007f4557770000)
	libuuid.so.1 => /data/poky-master/tmp/sysroots/x86_64-linux/usr/bin/../lib/libuuid.so.1 (0x00007f455756c000)
	libfdt.so.1 => /data/poky-master/tmp/sysroots/x86_64-linux/usr/bin/../lib/libfdt.so.1 (0x00007f4557366000)
	libgthread-2.0.so.0 => /data/poky-master/tmp/sysroots/x86_64-linux/usr/bin/../lib/libgthread-2.0.so.0 (0x00007f4557165000)
	libglib-2.0.so.0 => /data/poky-master/tmp/sysroots/x86_64-linux/usr/bin/../lib/libglib-2.0.so.0 (0x00007f4556e2d000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4556c25000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f455691a000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4556619000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4556403000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f45561e6000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4555e3d000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f4558d41000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4555c39000)

libSDL will only depend on GL if your distro wants OpenGL, so you should probably remove "opengl" from DISTRO_EFATURES too.  Removing "sdl" from qemu's PACKAGECONFIG will stop it linking to SDL at all.
Comment 3 Ross Burton 2015-10-01 15:14:32 UTC
If you remove opengl and x11 from DISTRO_FEATURES then qemu will happily build without any other intervention.  It links to SDL which isn't ideal but maybe you'll end up with some awesome ascii-rendered virtual machine.
Comment 4 Ross Burton 2015-10-01 15:25:36 UTC
In fact, this must be fixed in master already and is specific to 1.8 as I just removed x11 from DISTRO_FEATURES and qemu builds fine.

Marking as a potential 1.8.1 (impact needs to be reviewed) and assigning to the 1.8 maintainer.
Comment 5 Daniel Golle 2015-10-12 15:27:47 UTC
Thanks everyone for having a deeper look at the issue!
The intention is indeed to use qemu with libvirt headless with VMs providing only ASCII output, if any.
I didn't verify dependencies of SPICE/VNC because we don't use them, just mentioned them because that was the only thing which came into my mind what one could potentially use SDL or libGLU for on a headless system. If that doesn't require linking against libGLU, even better.
We got neither 'opengl' nor 'x11' set in DISTRO_EFATURES, however, adding both, 'x11' and 'opengl' to DISTRO_FEATURES is the current work-around leading to a successful qemu build based on poky-1.8.
Comment 6 Joshua Lock 2016-01-12 10:23:42 UTC
On the latest fido branch and x11 and opengl removed from DISTRO_FEATURES with the following in my local.conf:
    DISTRO_FEATURES_remove = "opengl x11"

I am able to build qemu (tested with a qemux86 MACHINE).

If this issue persists could you please provide steps for reproduction?
Comment 7 Ross Burton 2016-02-25 15:52:21 UTC
Closing as nobody else can replicate and the reporter hasn't provided any further feedback.

Daniel, if you can still replicate this, please reopen and provide more details.