sox fails to compile because it includes the wrong include files, and uses the wrong api. It should use alsa-lib, and not try to use the kernel device interface directly. It uses /usr/include/sound/asound.h when in fact it should use /usr/include/alsa/asoundlib.h This is not a quick fix, because sox is using completely the wrong alsa api. I suggest adjusting the ebuild so that the ./configure forces it to not try to compile alsa support into sox, until the author fixes the problem. Extract when trying to compile. gcc -O3 -pipe -Wall -I. -I. -c -o alsa.o alsa.c In file included from alsa.c:32: /usr/include/sound/asound.h:140: error: syntax error before '*' token /usr/include/sound/asound.h:143: error: syntax error before '}' token /usr/include/sound/asound.h:149: error: invalid application of `sizeof' to an incomplete type /usr/include/sound/asound.h:149: error: invalid application of `sizeof' to an incomplete type /usr/include/sound/asound.h:149: error: invalid application of `sizeof' to an incomplete type /usr/include/sound/asound.h:149: error: invalid application of `sizeof' to an incomplete type
sox-12.17.5 compiles without problem here. Please post the output of emerge info so we can compare with mine: Portage 2.0.50-r11 (default-x86-2004.2, gcc-3.3.4, glibc-2.3.3.20040420-r1, 2.6.8) ================================================================= System uname: 2.6.8 i686 Intel(R) Pentium(R) M processor 1.70GHz Gentoo Base System version 1.4.16 Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="ftp://mirror.pacific.net.au/gentoo http://mirror.pacific.net.au/linux/Gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.au.gentoo.org/gentoo-portage" USE="X acpi alsa apache2 avi bcmath berkdb bitmap-fonts bzlib caps cdr crypt cups divx4linux doc dvd encode fam gd gdbm gif gnome gpm gtk gtk2 guile imap imlib java jikes jpeg ldap libwww mad memlimit mmx motif mozilla mpeg mysql ncurses offensive oggvorbis opengl pam pdflib perl png python quicktime readline samba sdl slang spell sse ssl svg svga tcltk theora tiff truetype x86 xml2 xmms xprint xv zlib"
The ALSA guys themselves say not to use the ALSA API directly (it may change without notice), but ALSA-lib. But it looks like adding '#include <linux/compiler.h>' to the top of alsa.c makes the thing compile (it probably defines the __user symbol). Including a kernel header directly is a bit messy though, I don't even know for which kernels this will work (why didn't the SoX guys add this themselves?).
Adding '#include <linux/compiler.h>' to the top of alsa.c allows sox to compile for me. I used ebuild: unpack, make change to alsa.c, compile, install qmerge. There seems to have been some discussion about the bug on the sox mailist.
I'm still getting the same errors even when trying Geoff's suggestion. This is a warning message that is in the configure section: configure: WARNING: sound/asound.h: present but cannot be compiled configure: WARNING: sound/asound.h: check for missing prerequisite headers? configure: WARNING: sound/asound.h: proceeding with the preprocessor's result configure: WARNING: ## ------------------------------------ ## configure: WARNING: ## Report this to bug-autoconf@gnu.org. ## configure: WARNING: ## ------------------------------------ ## This is the error when doing make: /usr/include/sound/asound.h:140: error: parse error before '*' token /usr/include/sound/asound.h:143: error: parse error before '}' token /usr/include/sound/asound.h:149: error: invalid application of `sizeof' to incompletetype `sndrv_hwdep_dsp_image' /usr/include/sound/asound.h:149: error: invalid application of `sizeof' to incompletetype `({anonymous})' /usr/include/sound/asound.h:149: error: invalid application of `sizeof' to incompletetype `sndrv_hwdep_dsp_image' /usr/include/sound/asound.h:149: error: invalid application of `sizeof' to incompletetype `sndrv_hwdep_dsp_image' /usr/include/sound/asound.h:451: error: variable or field `__user' declared void /usr/include/sound/asound.h:451: error: parse error before '*' token /usr/include/sound/asound.h:453: error: parse error before '}' token /usr/include/sound/asound.h:457: error: variable or field `__user' declared void /usr/include/sound/asound.h:457: error: parse error before '*' token /usr/include/sound/asound.h:459: error: parse error before '}' token /usr/include/sound/asound.h:484: error: invalid application of `sizeof' to incompletetype `sndrv_xferi' /usr/include/sound/asound.h:484: error: invalid application of `sizeof' to incompletetype `({anonymous})' /usr/include/sound/asound.h:484: error: invalid application of `sizeof' to incompletetype `sndrv_xferi' /usr/include/sound/asound.h:484: error: invalid application of `sizeof' to incompletetype `sndrv_xferi' /usr/include/sound/asound.h:485: error: invalid application of `sizeof' to incompletetype `sndrv_xferi' /usr/include/sound/asound.h:485: error: invalid application of `sizeof' to incompletetype `({anonymous})' /usr/include/sound/asound.h:485: error: invalid application of `sizeof' to incompletetype `sndrv_xferi' /usr/include/sound/asound.h:485: error: invalid application of `sizeof' to incompletetype `sndrv_xferi' /usr/include/sound/asound.h:486: error: invalid application of `sizeof' to incompletetype `sndrv_xfern' /usr/include/sound/asound.h:486: error: invalid application of `sizeof' to incompletetype `({anonymous})' /usr/include/sound/asound.h:486: error: invalid application of `sizeof' to incompletetype `sndrv_xfern' /usr/include/sound/asound.h:486: error: invalid application of `sizeof' to incompletetype `sndrv_xfern' /usr/include/sound/asound.h:487: error: invalid application of `sizeof' to incompletetype `sndrv_xfern' /usr/include/sound/asound.h:487: error: invalid application of `sizeof' to incompletetype `({anonymous})' /usr/include/sound/asound.h:487: error: invalid application of `sizeof' to incompletetype `sndrv_xfern' /usr/include/sound/asound.h:487: error: invalid application of `sizeof' to incompletetype `sndrv_xfern' /usr/include/sound/asound.h:781: error: parse error before '*' token /usr/include/sound/asound.h:783: error: parse error before '}' token /usr/include/sound/asound.h:845: error: invalid application of `sizeof' to incompletetype `sndrv_ctl_elem_list' /usr/include/sound/asound.h:845: error: invalid application of `sizeof' to incompletetype `({anonymous})' /usr/include/sound/asound.h:845: error: invalid application of `sizeof' to incompletetype `sndrv_ctl_elem_list' /usr/include/sound/asound.h:845: error: invalid application of `sizeof' to incompletetype `sndrv_ctl_elem_list'
Portage 2.0.50-r11 (default-x86-2004.0, gcc-3.3.4, glibc-2.3.4.20040808-r0, 2.6.8.1.no-libata) ================================================================= System uname: 2.6.8.1.no-libata i686 Intel(R) Pentium(R) 4 CPU 2.80GHz Gentoo Base System version 1.5.3 Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CFLAGS="-O3 -pipe" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3.3/share/config:/usr/kde/3.3/env:/usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache nostrip sandbox" GENTOO_MIRRORS="http://ftp.heanet.ie/pub/gentoo/ http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo http://mirror.clarkson.edu/pub/distributions/gentoo/" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/u/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="X acpi alsa apache2 apm arts avi berkdb bitmap-fonts cdr crypt cups dba debug dvd dvdr encode esd flac foomaticdb gd gdbm gif gnome gpm gtk gtk2 guile imlib ipv6 java joystick jpeg kde ldap libg++ libwww mad mikmod motif mozilla mpeg mysql ncurses nls objc oggvorbis opengl oss pam pdflib perl png python qt quicktime readline samba sasl scanner sdl slang spell ssl svga tcltk tcpd tetex threads truetype usb x86 xml xml2 xmms xprint xv zlib"
For those that are interested, I am an ALSA developer. I pointed out the problem with sox, and just trying to make it compile is not the correct solution. sox should have it's alsa code completely re-written to use the correct programming api.
Emerges and installs without a problem using USE="-alsa" emerge sox
James does that mean you are suggesting it is better to echo "media-sound/sox -alsa" >> /etc/portage/package.use until the alsa support in sox is redone?
Yes. ALSA 1.0.6 emulates OSS well enough for sox to work.
*** Bug 59962 has been marked as a duplicate of this bug. ***
Filed the bug upstream... looks like they're struggling with it on the mailing list as well. It looks like the author wants to maintain his connection to the kernel interface because he feels that alsa-lib and sox do similar things and that using alsa-lib on top of sox will provide too much overhead. https://sourceforge.net/tracker/index.php?func=detail&aid=1026394&group_id=10706&atid=110706 I've also pushed out a new version of the ebuild that automatically disables ALSA support.
ok, well it's no longer a gentoo issue at this point, so closing... but I'll keep an eye on it... hopefully the author wises up a bit... for now, we're forcing -alsa +oss