Bug 7382

Summary: QEMU fails to build on Debian / Ubuntu when oss4-dev is installed ( error: 'SNDCTL_DSP_MAPINBUF' undeclared here (not in a function) )
Product: [Documentation] Quick Start Reporter: Carlos Alberto Lopez Perez <clopez>
Component: quick-startAssignee: Scott Rifenbark <srifenbark>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided CC: bluelightning, clopez, poky.doc.watcher, poky.watcher, srifenbark
Version: unspecified   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard: 06 March 2015: RESOLVED/FIXED
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)

Description Carlos Alberto Lopez Perez 2015-03-02 14:01:45 UTC
The package oss4-dev installs its own custom /usr/include/linux/soundcard.h file on Debian/Ubuntu distributions.

When the user has installed this package and tries to build yocto, qemu will fail to build.

The output is the following:

| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:192:9: error: 'SNDCTL_DSP_MAPINBUF' undeclared here (not in a function)
|    IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:192:9: error: 'SNDCTL_DSP_MAPINBUF' undeclared here (not in a function)
|    IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:193:9: error: 'SNDCTL_DSP_MAPOUTBUF' undeclared here (not in a function)
|    IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:193:9: error: 'SNDCTL_DSP_MAPOUTBUF' undeclared here (not in a function)
|    IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:248:9: error: 'SOUND_MIXER_ACCESS' undeclared here (not in a function)
|    IOCTL(SOUND_MIXER_ACCESS, 0, TYPE_PTRVOID)
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:248:9: error: 'SOUND_MIXER_ACCESS' undeclared here (not in a function)
|    IOCTL(SOUND_MIXER_ACCESS, 0, TYPE_PTRVOID)
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:192:9: error: 'SNDCTL_DSP_MAPINBUF' undeclared here (not in a function)
|    IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:193:9: error: 'SNDCTL_DSP_MAPOUTBUF' undeclared here (not in a function)
|    IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:248:9: error: 'SOUND_MIXER_ACCESS' undeclared here (not in a function)
|    IOCTL(SOUND_MIXER_ACCESS, 0, TYPE_PTRVOID)
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:192:9: error: 'SNDCTL_DSP_MAPINBUF' undeclared here (not in a function)
|    IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:193:9: error: 'SNDCTL_DSP_MAPOUTBUF' undeclared here (not in a function)
|    IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/ioctls.h:248:9: error: 'SOUND_MIXER_ACCESS' undeclared here (not in a function)
|    IOCTL(SOUND_MIXER_ACCESS, 0, TYPE_PTRVOID)
|          ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/linux-user/syscall.c:3826:23: note: in definition of macro 'IOCTL'
|      { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
|                        ^
| /stuff/yocto/qemu-build/tmp/work/x86_64-linux/qemu-native/2.2.0-r1/qemu-2.2.0/rules.mak:57: recipe for target 'linux-user/syscall.o' failed
| make[1]: *** [linux-user/syscall.o] Error 1
| Makefile:169: recipe for target 'subdir-aarch64-linux-user' failed
| make: *** [subdir-aarch64-linux-user] Error 2
| make: *** Waiting for unfinished jobs....


The following Debian bug is relevant: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=575320

I think the documentation should tell the Debian/Ubuntu users to do any of:

$ sudo apt-get build-dep qemu

$ sudo apt-get remove oss4-dev
Comment 1 Scott Rifenbark 2015-03-02 16:44:29 UTC
Carlos, 

Thanks for reporting on this situation.  Because the possibility of this problem is slim and another project, QEMU, has a finger in it, mentioning your work-around in the mainstream YP documentation is not really appropriate.  

Thanks, 
Scott
Comment 2 Carlos Alberto Lopez Perez 2015-03-02 17:15:28 UTC
(In reply to comment #1)
> Carlos, 
> 
> Thanks for reporting on this situation.  Because the possibility of this
> problem is slim and another project, QEMU, has a finger in it, mentioning
> your work-around in the mainstream YP documentation is not really
> appropriate.  
> 
> Thanks, 
> Scott

I don't think is a work around. QEMU has a build incompatibility with oss4-dev.

On a Debian/Ubuntu distribution if you do:

$ sudo apt-get build-dep qemu

apt-get will remove oss4-dev (if you have it installed) and it will install all the required dependencies to build qemu.

QEMU is not going to fix this because is not their problem (you are using the wrong header), and Debian/Ubuntu have already fixed it (on 2010, see the bug report dates) by declaring a build-incompatibility on oss4-dev for the QEMU package.

I understand that this is a minor issue since oss4-dev is not a package that developers usually have installed. But it has bitten me when trying the quick start guide of Yocto and probably it will bite another developers on the future.
Comment 3 Carlos Alberto Lopez Perez 2015-03-02 17:26:27 UTC
(In reply to comment #2)
> and probably it will bite another developers on the future.

Some examples of people that was affected by this:

https://lists.yoctoproject.org/pipermail/yocto/2013-August/015511.html
https://lists.yoctoproject.org/pipermail/yocto/2013-September/015942.html

BTW, At least I'm retitling the bug to make it easier to find for anyone affected.

Regards.
Comment 4 Scott Rifenbark 2015-03-06 14:04:10 UTC
Hi, 

So I thought about this a bit more and we have a "note" for some oddities around the CentOS distribution.  So, I decided to place a note in the Debian area to address this issue.  You can see the note at http://www.yoctoproject.org/docs/1.8/yocto-project-qs/yocto-project-qs.html#ubuntu.

Thanks, 
Scott
Comment 5 Carlos Alberto Lopez Perez 2015-03-06 15:00:41 UTC
Looks great :)

Thanks!