[Regression] error when trying to compile a program which uses alsa/asoundlib.h with EGLIBC 2.17

Bug #1109298 reported by Matthieu Baerts
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
alsa-lib (Fedora)
Fix Released
Undecided
alsa-lib (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Hello,

Firstly, thank you for maintaining and packaging this complex project!

I'm not sure that this bug is due to libc6 but with the latest version (and not with the previous one: I just downgraded to the previous version and I don't have this problem with it) I'm no longer able to compile a Cairo-Dock's plugin which includes <alsa/asoundlib.h>.

Here is the error:

=================

  $ env LANG=C make VERBOSE=1
/usr/bin/cc -DCAIRO_DOCK_FORCE_ICON_IN_MENUS=1 -DDBUSMENU_GTK3_NEW=1 -DGL_GLEXT_PROTOTYPES=\"1\" -DGTK_DISABLE_DEPRECATED=\"1\" -DMY_APPLET_CONF_FILE=\"AlsaMixer.conf\" -DMY_APPLET_DOCK_VERSION=\"3.1.99.beta0\" -DMY_APPLET_GETTEXT_DOMAIN=\"cairo-dock-plugins\" -DMY_APPLET_ICON_FILE=\"icon.png\" -DMY_APPLET_PREVIEW_FILE=\"preview.jpg\" -DMY_APPLET_SHARE_DATA_DIR=\"/usr/share/cairo-dock/plug-ins/AlsaMixer\" -DMY_APPLET_USER_DATA_DIR=\"AlsaMixer\" -DMY_APPLET_VERSION=\"2.1.3\" -DSOUND_SERVICE_SUPPORT=\"1\" -DSOUND_SERVICE_VERSION=1 -Dcd_AlsaMixer_EXPORTS -fPIC -I/usr/include/gtk-3.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/cairo -I/usr/include/librsvg-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/libxml2 -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/cairo-dock -I/usr/include/cairo-dock/gldit -I/usr/include/cairo-dock/icon-factory -I/usr/include/cairo-dock/implementations -I/usr/include/alsa -I/usr/include/libdbusmenu-glib-0.4 -I/usr/include/libdbusmenu-gtk3-0.4 -I/usr/include/libindicator3-0.4 -I/usr/include/libido3-0.1 -I/opt/cairo-dock_bzr/cairo-dock-plug-ins/Indicator-applet -std=c99 -Wall -o CMakeFiles/cd-AlsaMixer.dir/applet-init.c.o -c /opt/cairo-dock_bzr/cairo-dock-plug-ins/alsaMixer/src/applet-init.c
In file included from /usr/include/alsa/asoundlib.h:49:0,
                 from /opt/cairo-dock_bzr/cairo-dock-plug-ins/alsaMixer/src/applet-struct.h:23,
                 from /opt/cairo-dock_bzr/cairo-dock-plug-ins/alsaMixer/src/applet-init.c:20:
/usr/include/alsa/pcm.h:944:1: error: unknown type name 'u_int8_t'
/usr/include/alsa/pcm.h:945:1: error: unknown type name 'u_int16_t'
/usr/include/alsa/pcm.h:946:1: error: unknown type name 'u_int32_t'
/usr/include/alsa/pcm.h:947:1: error: unknown type name 'u_int64_t'
/usr/include/alsa/pcm.h:1052:1: error: unknown type name 'int16_t'
make[2]: *** [alsaMixer/src/CMakeFiles/cd-AlsaMixer.dir/applet-init.c.o] Error 1
make[2]: Leaving directory `/opt/cairo-dock_bzr/cairo-dock-plug-ins/build'
make[1]: *** [alsaMixer/src/CMakeFiles/cd-AlsaMixer.dir/all] Error 2
make[1]: Leaving directory `/opt/cairo-dock_bzr/cairo-dock-plug-ins/build'
make: *** [all] Error 2

=================

It seems that 'u_intX_t' ('u_int8_t', etc.) are defined in <sys/types.h>.
Should I have to report this bug to alsa devs or now should I have to include <sys/types.h> before including <alsa/asoundlib.h>?

Regards,

Matt

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: libc6 2.17-0ubuntu1
ProcVersionSignature: Ubuntu 3.8.0-2.6-generic 3.8.0-rc4
Uname: Linux 3.8.0-2-generic x86_64
ApportVersion: 2.8-0ubuntu2
Architecture: amd64
Date: Tue Jan 29 21:30:07 2013
InstallationDate: Installed on 2011-08-10 (538 days ago)
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Alpha amd64 (20110803.1)
MarkForUpload: True
SourcePackage: eglibc
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
In , Richard (richard-redhat-bugs) wrote :

Description of problem:
While trying to build the latest mythtv on RPM Fusion for rawhide I ran into the following issue:

g++ -c -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -O2 -g
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -fomit-frame-pointer
-fomit-frame-pointer -fPIC -pthread -g -Wall -Wpointer-arith
-Wno-non-virtual-dtor -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
-fvisibility-inlines-hidden -Wmissing-declarations -Wno-switch
-Wredundant-decls -funit-at-a-time -D_REENTRANT -fPIC -DMMX
-D_GNU_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED
-I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore
-I/usr/include -I/usr/include -I/usr -I/usr/include/libxml2
-I../../zeromq/include -I../../nzmqt/include/nzmqt -I../include -I.
-I. -o parser.o parser.cpp
In file included from /usr/include/alsa/asoundlib.h:49:0,
                 from libavdevice/alsa-audio-common.c:31:
/usr/include/alsa/pcm.h:944:1: error: unknown type name 'u_int8_t'
/usr/include/alsa/pcm.h:945:1: error: unknown type name 'u_int16_t'
/usr/include/alsa/pcm.h:946:1: error: unknown type name 'u_int32_t'
/usr/include/alsa/pcm.h:947:1: error: unknown type name 'u_int64_t'
In file included from /usr/include/alsa/asoundlib.h:49:0,
                 from libavdevice/alsa-audio-common.c:31:
/usr/include/alsa/pcm.h:1052:1: error: unknown type name 'int16_t'
make[2]: *** [libavdevice/alsa-audio-common.o] Error 1
make[2]: Leaving directory
`/builddir/build/BUILD/MythTV-mythtv-d2f9798/mythtv/external/FFmpeg'
make[1]: *** [FFmpeg-all] Error 2

Version-Release number of selected component (if applicable):
alsa-lib-devel-1.0.26-1.fc19.x86_64

A mythtv dev suggested the following *might* be the fix. Since I build mythtv in mock/rpmbuild I don't think it's possible/practical to test this patch:

--- /usr/include/alsa/asoundlib.h 2012-09-06 06:18:02.000000000 -0700
+++ asoundlib.h 2012-12-07 19:30:53.131751067 -0800
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <string.h>
 #include <fcntl.h>
 #include <assert.h>

Revision history for this message
In , Richard (richard-redhat-bugs) wrote :

Created attachment 660967
Git diff from master

I have verified that the patch essentially works (I had to actually patch asoundlib-head.h)

Revision history for this message
In , Richard (richard-redhat-bugs) wrote :

Created attachment 660968
Patch to asoundlib.h

Attaching since I couldn't get it to show up in the git diff...

Revision history for this message
In , Gary (gary-redhat-bugs) wrote :

(In reply to comment #0)
.....
> A mythtv dev suggested the following *might* be the fix.

I believe the (root) cause is that stdlib.h no longer
includes sys/types.h, and the alsa includes depend on
the u_int... types being defined (which were being
defined in sys/types.h, no longer included).

Revision history for this message
In , Richard (richard-redhat-bugs) wrote :

As it's been 10 days since the last comment on this bug I just wanted to ping you guys to see if anyone is working on a fix.

I would think that breaking a program from building would be considered a serious, though not urgent, bug.

Revision history for this message
Matthieu Baerts (matttbe) wrote :
summary: - [Regression] error when trying to compile a module which use
+ [Regression] error when trying to compile a program which uses
alsa/asoundlib.h with EGLIBC 2.17
description: updated
Revision history for this message
Adam Conrad (adconrad) wrote :

It could be a bit more interesting than just "include some more headers" for the proper upstream fix:

#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD
# include <sys/types.h> /* we need int32_t... */

stdlib.h *does* include sys/types.h, but only under certain conditions. It's entirely plausible that those conditions aren't being met by alsa which, previously, may have been mistakenly making use of sysv/xopen extensions without declaring so, but some other part of the toolchain picked up the slack and papered over it.

affects: eglibc (Ubuntu) → alsa-lib (Ubuntu)
no longer affects: eglibc (Fedora)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package alsa-lib - 1.0.25-4ubuntu3

---------------
alsa-lib (1.0.25-4ubuntu3) raring; urgency=low

  * sys_types_include.patch: Explicitly include <sys/types.h> (LP: #1109298)
 -- Adam Conrad <email address hidden> Sat, 09 Feb 2013 20:07:54 -0700

Changed in alsa-lib (Ubuntu):
status: New → Fix Released
Revision history for this message
Matthieu Baerts (matttbe) wrote :

Thank you for all these details and this patch! :)

Revision history for this message
David Henningsson (diwic) wrote : [PATCH] alsa-lib: Add sys/types.h to include list

This is needed by snd_pcm_format_silence* functions which
return u_int*_t. It was discovered while trying to compile ALSA
programs with eglibc 2.17.

Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
 Adam Conrad for this fix.

BugLink: https://bugs.launchpad.net/bugs/1109298
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=885306
Signed-off-by: David Henningsson <email address hidden>
---
 include/asoundlib-head.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h
index 20c8a68..6edbab0 100644
--- a/include/asoundlib-head.h
+++ b/include/asoundlib-head.h
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <string.h>
 #include <fcntl.h>
 #include <assert.h>
--
1.7.9.5

Revision history for this message
Takashi Iwai (tiwai) wrote :

At Tue, 12 Feb 2013 10:06:11 +0100,
David Henningsson wrote:
>
> This is needed by snd_pcm_format_silence* functions which
> return u_int*_t. It was discovered while trying to compile ALSA
> programs with eglibc 2.17.
>
> Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
> Adam Conrad for this fix.
>
> BugLink: https://bugs.launchpad.net/bugs/1109298
> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=885306
> Signed-off-by: David Henningsson <email address hidden>

For u_int_* types, wouldn't it better to include stdint.h?

Takashi

> ---
> include/asoundlib-head.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h
> index 20c8a68..6edbab0 100644
> --- a/include/asoundlib-head.h
> +++ b/include/asoundlib-head.h
> @@ -31,6 +31,7 @@
> #include <unistd.h>
> #include <stdio.h>
> #include <stdlib.h>
> +#include <sys/types.h>
> #include <string.h>
> #include <fcntl.h>
> #include <assert.h>
> --
> 1.7.9.5
>

Revision history for this message
David Henningsson (diwic) wrote :

On 02/12/2013 10:10 AM, Takashi Iwai wrote:
> At Tue, 12 Feb 2013 10:06:11 +0100,
> David Henningsson wrote:
>>
>> This is needed by snd_pcm_format_silence* functions which
>> return u_int*_t. It was discovered while trying to compile ALSA
>> programs with eglibc 2.17.
>>
>> Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
>> Adam Conrad for this fix.
>>
>> BugLink: https://bugs.launchpad.net/bugs/1109298
>> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=885306
>> Signed-off-by: David Henningsson <email address hidden>
>
> For u_int_* types, wouldn't it better to include stdint.h?

Hmm, it looks like stdint.h declares uint_* whereas sys/types.h declares
u_int_* (notice the _ between "u" and "int"). Do you think we should
change snd_pcm_format_silence* from u_int to uint?

>
>
> Takashi
>
>> ---
>> include/asoundlib-head.h | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h
>> index 20c8a68..6edbab0 100644
>> --- a/include/asoundlib-head.h
>> +++ b/include/asoundlib-head.h
>> @@ -31,6 +31,7 @@
>> #include <unistd.h>
>> #include <stdio.h>
>> #include <stdlib.h>
>> +#include <sys/types.h>
>> #include <string.h>
>> #include <fcntl.h>
>> #include <assert.h>
>> --
>> 1.7.9.5
>>
>

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

Revision history for this message
Tanu Kaskinen (tanuk) wrote : Re: [alsa-devel] [PATCH] alsa-lib: Add sys/types.h to include list

On Tue, 2013-02-12 at 10:06 +0100, David Henningsson wrote:
> This is needed by snd_pcm_format_silence* functions which
> return u_int*_t. It was discovered while trying to compile ALSA
> programs with eglibc 2.17.
>
> Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
> Adam Conrad for this fix.
>
> BugLink: https://bugs.launchpad.net/bugs/1109298
> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=885306
> Signed-off-by: David Henningsson <email address hidden>
> ---
> include/asoundlib-head.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h
> index 20c8a68..6edbab0 100644
> --- a/include/asoundlib-head.h
> +++ b/include/asoundlib-head.h
> @@ -31,6 +31,7 @@
> #include <unistd.h>
> #include <stdio.h>
> #include <stdlib.h>
> +#include <sys/types.h>

int*_t and uint*_t (not u_int*_t) are standard in C99, and they are
available in stdint.h or inttypes.h (both work, inttypes.h contains also
the PRI* constants for the corresponding printf() format specifiers).
Perhaps it would be better to use one of those headers instead? That
would require converting u_int*_t usage to uint*_t, though, so it would
take some extra work...

--
Tanu

Revision history for this message
Takashi Iwai (tiwai) wrote : Re: [PATCH] alsa-lib: Add sys/types.h to include list

At Tue, 12 Feb 2013 10:16:13 +0100,
David Henningsson wrote:
>
> On 02/12/2013 10:10 AM, Takashi Iwai wrote:
> > At Tue, 12 Feb 2013 10:06:11 +0100,
> > David Henningsson wrote:
> >>
> >> This is needed by snd_pcm_format_silence* functions which
> >> return u_int*_t. It was discovered while trying to compile ALSA
> >> programs with eglibc 2.17.
> >>
> >> Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
> >> Adam Conrad for this fix.
> >>
> >> BugLink: https://bugs.launchpad.net/bugs/1109298
> >> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=885306
> >> Signed-off-by: David Henningsson <email address hidden>
> >
> > For u_int_* types, wouldn't it better to include stdint.h?
>
> Hmm, it looks like stdint.h declares uint_* whereas sys/types.h declares
> u_int_* (notice the _ between "u" and "int"). Do you think we should
> change snd_pcm_format_silence* from u_int to uint?

Ah, OK, then sys/types.h is the right inclusion.

Maybe conversion to uint_*_t would be more universal, but I don't
think it's worth, as these types are used in many places in the public
API already.

I'll take your patch as is now.

thanks,

Takashi

Revision history for this message
In , Gary (gary-redhat-bugs) wrote :
Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Revision history for this message
In , Richard (richard-redhat-bugs) wrote :

(In reply to comment #4)
> As it's been 10 days since the last comment on this bug I just wanted to
> ping you guys to see if anyone is working on a fix.
>
> I would think that breaking a program from building would be considered a
> serious, though not urgent, bug.

Ping?

Revision history for this message
In , Stephen (stephen-redhat-bugs) wrote :

Taking over this trivial fix as a provenpackager action.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

alsa-lib-1.0.26-4.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/alsa-lib-1.0.26-4.fc19

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

Package alsa-lib-1.0.26-4.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing alsa-lib-1.0.26-4.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-4892/alsa-lib-1.0.26-4.fc19
then log in and leave karma (feedback).

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

alsa-lib-1.0.26-4.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.

Revision history for this message
Tomi Leppänen (tomin) wrote :

How come I have a very similar problem when trying to compile Mythtv? I have the same error message although I use the latest packages on Ubuntu raring. libasound2-dev is version 1.0.25-4ubuntu3.

In file included from /usr/include/alsa/asoundlib.h:49:0,
                 from libavdevice/alsa-audio-common.c:31:
/usr/include/alsa/pcm.h:944:1: virhe: unknown type name ”u_int8_t”
/usr/include/alsa/pcm.h:945:1: virhe: unknown type name ”u_int16_t”
/usr/include/alsa/pcm.h:946:1: virhe: unknown type name ”u_int32_t”
/usr/include/alsa/pcm.h:947:1: virhe: unknown type name ”u_int64_t”
In file included from /usr/include/alsa/asoundlib.h:49:0,
                 from libavdevice/alsa-audio-common.c:31:
/usr/include/alsa/pcm.h:1052:1: virhe: unknown type name ”int16_t”
In file included from /usr/include/alsa/asoundlib.h:49:0,
                 from libavdevice/alsa-audio-enc.c:40:
/usr/include/alsa/pcm.h:944:1: virhe: unknown type name ”u_int8_t”
/usr/include/alsa/pcm.h:945:1: virhe: unknown type name ”u_int16_t”
/usr/include/alsa/pcm.h:946:1: virhe: unknown type name ”u_int32_t”
/usr/include/alsa/pcm.h:947:1: virhe: unknown type name ”u_int64_t”
In file included from /usr/include/alsa/asoundlib.h:49:0,
                 from libavdevice/alsa-audio-enc.c:40:
/usr/include/alsa/pcm.h:1052:1: virhe: unknown type name ”int16_t”

Changed in alsa-lib (Fedora):
importance: Unknown → Undecided
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.