Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 313259 - app-emulation/emul-linux-x86-soundlibs-20100220-r1: libsndfile: SF_INFO struct ordering incorrect
Summary: app-emulation/emul-linux-x86-soundlibs-20100220-r1: libsndfile: SF_INFO struc...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: AMD64 Linux
: High major (vote)
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: emul-tracker
  Show dependency tree
 
Reported: 2010-04-05 16:57 UTC by Marc Joliet
Modified: 2011-09-27 19:39 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
simple test program (libsndfile_test.c,674 bytes, text/plain)
2010-04-05 16:58 UTC, Marc Joliet
Details
audio file used by test program (test.aif,1.10 MB, audio/x-aiff)
2010-04-05 17:15 UTC, Marc Joliet
Details
simple test program (libsndfile_test.c,625 bytes, text/plain)
2010-04-05 19:00 UTC, Marc Joliet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Joliet 2010-04-05 16:57:19 UTC
The ordering of the SF_INFO struct returned by sf_open() is incorrect when using the version of libsndfile in app-emulation/emul-linux-x86-soundlibs-20100220-r1. The order is correct when using the 64bit version.

I'm not so versed in the details of C that I have any idea as to what could be going wrong here, but a tiny test program compiled for amd64 with the -m32 option produces different output than without, so I believe something went wrong in the compilation process of libsndfile.

Reproducible: Always

Steps to Reproduce:
1. install emul-linux-x86-soundlibs via "emerge =app-emulation/emul-linux-x86-soundlibs-20100220-r1"
2. compile test program via "gcc -lsndfile libsndfile_test.c -o libsndfile_test"
3. run "./libsndfile_test"
Actual Results:  
The output is wrong:
% ./libsndfile_test
Frames     : 287850
Samplerate : 0
Channels   : 44100
Format     : 2
Sections   : 131074
Seekable   : 1

Expected Results:  
The output is correct:
% ./libsndfile_test
Frames     : 287850
Samplerate : 44100
Channels   : 2
Format     : 131074
Sections   : 1
Seekable   : 1

% emerge --info app-emulation/emul-linux-x86-soundlibs libsndfile
Portage 2.1.7.17 (default/linux/amd64/10.0, gcc-4.3.4, glibc-2.10.1-r1, 2.6.33-gentoo x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.33-gentoo-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4200+-with-gentoo-2.0.1
Timestamp of tree: Sun, 04 Apr 2010 20:20:01 +0000
app-shells/bash:     4.0_p35
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.4-r1
dev-python/pycrypto: 2.1.0_beta1
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.4_p6-r1, 1.8.5-r4, 1.9.6-r3, 1.10.3
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.1.2, 4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/share/config/kdm /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="assume-digests buildpkg collision-protect distlocks fixpackages metadata-transfer news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/ ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://mirror.muntinternet.net/pub/gentoo/"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en_US en en_GB de"
MAKEOPTS="-s -j3"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="lzma"
PORTAGE_COMPRESS_FLAGS="-9"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/science /usr/local/portage/layman/sunrise /usr/local/portage/layman/pd-overlay /usr/local/portage/layman/pcsx2 /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac aalib accessibility acl acpi alsa amd64 audiofile avahi bash-completion berkdb blas branding bzip2 cairo caps cdda cdinstall cdr chipcard cjk cli consolekit cracklib crypt css cups cxx dbus dga djvu dri dssi dts dvd dvdnav dvdr dvi encode exif fbcon ffmpeg fftw flac fortran ftp fuse gdbm gif gimp glitz glut gmp gnuplot gnutls gpm gtk hal hbci iconv idn imlib inotify ipv6 jack jpeg jpeg2k kipi ladspa lapack lash latex lcms libcaca libnotify libsamplerate lm_sensors logrotate lzma mad matroska mikmod mjpeg mmx mmxext mng modplug modules mp3 mp4 mpeg mudflap multilib musepack musicbrainz ncurses nfs nls nntp nptl nptlonly nsplugin offensive ogg openal openexr opengl openmp pam pango pcre pdf plotutils png policykit ppds pppd pulseaudio python qt4 quicktime rar readline reflection rtsp samba sasl sdl session sid slang slp smp sndfile speex spell spl sse sse2 sse3 ssl startup-notification svg sysfs taglib tcpd theora threads tiff timidity truetype unicode usb vcd vim-syntax vorbis webkit wma x264 xattr xcb xcomposite xface xft xml xmp xorg xpm xscreensaver xulrunner xv xvid xvmc zeroconf zlib zsh-completion" ALSA_CARDS="ice1724 hda-intel usb-audio" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_US en en_GB de" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon nv vesa" 
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

app-emulation/emul-linux-x86-soundlibs-20100220-r1 was built with the following:
USE="alsa (multilib) pulseaudio" 


media-libs/libsndfile-1.0.21 was built with the following:
USE="alsa (multilib) -minimal -sqlite" 
CFLAGS="-O2 -march=native -pipe -msse3"
CXXFLAGS="-O2 -march=native -pipe -msse3"
Comment 1 Marc Joliet 2010-04-05 16:58:32 UTC
Created attachment 226649 [details]
simple test program
Comment 2 Marc Joliet 2010-04-05 17:15:33 UTC
Created attachment 226651 [details]
audio file used by test program
Comment 3 Pacho Ramos gentoo-dev 2010-04-05 18:20:24 UTC
CCing sound team since I don't know where could be the problem :-(

Sound Team: emul package is providing media-libs/libsndfile-1.0.21

Thanks a lot
Comment 4 Marc Joliet 2010-04-05 19:00:17 UTC
Created attachment 226663 [details]
simple test program

Uploaded a slightly modified version of the test program that fixes two stupid errors I should've noticed: wrong sizeof() parameter and use of free() instead of sf_close().
Comment 5 Marc Joliet 2010-04-05 20:55:28 UTC
Just a note: the test program prints the correct data when compiled under Ubuntu 9.10 (32 bits, libsndfile-1.0.20).
Comment 6 Marc Joliet 2010-04-06 08:07:59 UTC
I just tested with app-emulation/emul-linux-x86-soundlibs-20091231-r1 and get the same incorrect results. So far my only idea is that this might have to do with struct packing/padding or similar gcc options.
Comment 7 Pacho Ramos gentoo-dev 2010-04-09 12:09:01 UTC
More info for Sound team related with options used in emul chroot:
[ebuild   R   ] media-libs/libsndfile-1.0.21  USE="alsa -minimal -sqlite" 0 kB

emerge --info:
Portage 2.1.7.17 (default/linux/amd64/dev/32bit-userland, gcc-4.3.4, glibc-2.10.1-r1, 2.6.32-tuxonice-r6 i686)
=================================================================
System uname: Linux-2.6.32-tuxonice-r6-i686-Intel-R-_Core-TM-2_Duo_CPU_T9300_@_2.50GHz-with-gentoo-1.12.13
Timestamp of tree: Fri, 09 Apr 2010 07:00:01 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.4-r1
dev-python/pycrypto: 2.1.0_beta1
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.63-r1
sys-devel/automake:  1.6.3, 1.9.6-r2, 1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -mtune=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -mtune=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests buildpkg distlocks fixpackages multilib-strict news nodoc noinfo noman parallel-fetch protect-owned sandbox sfperms strict unmerge-logs userfetch"
GENTOO_MIRRORS="http://mirrors.sfo1.gni.com/Gentoo/ http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="es_ES.UTF-8"
LDFLAGS="-Wl,-O1,--as-needed,--hash-style=gnu"
MAKEOPTS="-j3 --quiet"
PKGDIR="/packages/"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="accessibility acpi amd64 berkdb bindist cli cpudetection cracklib crypt cxx dri fortran gdbm gif iconv ipv6 jpeg kerberos ldap mmx modules mudflap multilib ncurses nls nptl nptlonly openmp pam pcre perl png pppd readline reflection session spl sse sse2 ssl sysfs tiff unicode xinerama xorg zlib" ALSA_CARDS="*" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i810 intel mach64         mga neomagic nv r128 radeon radeonhd rendition s3 s3virge savage siliconmotion sis         sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 8 Marc Joliet 2010-04-29 15:26:42 UTC
Aha, I found out how to solve this. You need to define "_FILE_OFFSET_BITS=64",
i.e. compile with

"gcc -m32 -lsndfile -D_FILE_OFFSET_BITS=64 libsndfile_test.c -o libsndfile_test",

then the output of libsndfile_test is correct. According to
http://www.suse.de/~aj/linux_lfs.html, I need make sure to use the same
_FILE_OFFSET_BITS as the library I'm using. I'm still a bit confused though,
since the relevant section in "info libc 'Feature Test Macros'" says the macro
does nothing on 64 bit systems (unless it is only referring to the function
redefinitions), so why does it matter here?
Comment 9 Pacho Ramos gentoo-dev 2010-06-11 15:12:59 UTC
Still valid with 20100611?
Comment 10 Marc Joliet 2010-06-12 09:47:17 UTC
Yes, I still need to define _FILE_OFFSET_BITS=64 as per comment #8.
Comment 11 Pacho Ramos gentoo-dev 2010-06-12 11:08:16 UTC
Sound team, what do you think about appending -D_FILE_OFFSET_BITS=64 when  
use x86 && [ "$(get_libdir)" = "lib32" ]
?
Comment 12 Samuli Suominen (RETIRED) gentoo-dev 2010-06-12 11:25:01 UTC
(In reply to comment #11)
> Sound team, what do you think about appending -D_FILE_OFFSET_BITS=64 when  
> use x86 && [ "$(get_libdir)" = "lib32" ]
> ?
> 

I guess you want:

inherit flag-o-matic toolchain-funcs

[[ $(tc-arch) == "x86" ]] && append-lfs-flags
Comment 13 Pacho Ramos gentoo-dev 2010-06-12 11:53:31 UTC
My idea was to mimic pango way of handling building of emul packages that, in summary, needs to check it's running on "x86" but with /usr/lib32 instead of /usr/lib as LIBDIR:

function multilib_enabled() {
        has_multilib_profile || ( use x86 && [ "$(get_libdir)" = "lib32" ] )
}
(from pango ebuilds)

Comment 14 Samuli Suominen (RETIRED) gentoo-dev 2010-06-12 12:08:59 UTC
actually no need for those checks, appending largefile flags is safe enough without them, therefore:

+  12 Jun 2010; Samuli Suominen <ssuominen@gentoo.org>
+  libsndfile-1.0.21.ebuild:
+  append-lfs-flags wrt #313259 by Marc Joliet.
+

closing as FIXED, the fix will be available automatically with next emul- packages.
Comment 15 Pacho Ramos gentoo-dev 2010-06-12 14:29:02 UTC
Great! Thanks a lot
Comment 16 Samuli Suominen (RETIRED) gentoo-dev 2010-09-05 09:28:17 UTC
And reopen, can't use largefile flags here, see bug 335728.
Comment 17 Pacho Ramos gentoo-dev 2010-09-05 09:33:54 UTC
Would be safe to use it only for emul 32 libs?
Comment 18 Pacho Ramos gentoo-dev 2011-01-30 11:37:23 UTC
(In reply to comment #17)
> Would be safe to use it only for emul 32 libs?
> 

20110129 still doesn't append lfs flags then, probably this is still valid :-|, but I repeat previous question (for the next emul set)
Comment 19 Pacho Ramos gentoo-dev 2011-07-20 10:21:44 UTC
(In reply to comment #17)
> Would be safe to use it only for emul 32 libs?

Samuli, what do you think about this? Thanks
Comment 20 Samuli Suominen (RETIRED) gentoo-dev 2011-09-27 19:39:57 UTC
(In reply to comment #13)
> My idea was to mimic pango way of handling building of emul packages that, in
> summary, needs to check it's running on "x86" but with /usr/lib32 instead of
> /usr/lib as LIBDIR:
> 
> function multilib_enabled() {
>         has_multilib_profile || ( use x86 && [ "$(get_libdir)" = "lib32" ] )
> }
> (from pango ebuilds)

This was used now,

+  27 Sep 2011; Samuli Suominen <ssuominen@gentoo.org> libsndfile-1.0.25.ebuild:
+  Use largefile flags when building emul-linux- pkgs wrt #313259 by Marc Joliet
+  and Pacho Ramos