Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 49450

Summary: avifile-0.7.38.20030710 fails to compile with gcc 3.4
Product: Gentoo Linux Reporter: gent_bz
Component: Current packagesAssignee: Gentoo Media-video project <media-video>
Status: RESOLVED FIXED    
Severity: normal CC: ares, gcc-porting, kathywills, magnade
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 48528    
Attachments: avifile-0.7.38.20030710-gcc-3.4.patch

Description gent_bz 2004-04-29 18:46:30 UTC
emerge avifile barfs with the following :

i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c reservoir.c
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
quantize-pvt.c: In function `quantize_xrpow':
quantize-pvt.c:978: error: PIC register `%ebx' clobbered in `asm'



Reproducible: Always
Steps to Reproduce:
1. emerge =sys-devel/gcc-3.4.0
2. emerge avifile




Portage 2.0.50-r6 (default-x86-2004.0, gcc-3.4.0, glibc-2.3.3_pre20040420-r0,
2.6.5-gentoo-r1)
=================================================================
System uname: 2.6.5-gentoo-r1 i686 AMD Athlon(tm)
Gentoo Base System version 1.4.10
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=athlon-xp -fomit-frame-pointer -ftracer -pipe
-maccumulate-outgoing-args -fprefetch-loop-arrays"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
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=athlon-xp -fomit-frame-pointer -ftracer -pipe
-maccumulate-outgoing-args -fprefetch-loop-arrays"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://linux.ntcu.net/dists/gentoo/
http://gentoo.seren.com/gentoo http://gentoo.ccccom.com"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://192.168.0.238/gentoo-portage"
USE="3dnow X aalib alsa apm avi berkdb cdr crypt cups curl dedicated dv dvd
encode esd faad foomaticdb gdbm gif gnome gpm gstreamer gtk gtk2 imlib jpeg lcms
libg++ libwww mad mbox mikmod mmx motif mozilla mpeg ncurses nls nptl oggvorbis
opengl oss pam pdflib perl png ppds python qt quicktime readline samba sdl slang
spell sse ssl tcpd tiff truetype usb videos wmf x86 xml xml2 xmms xv zlib"
Comment 1 Kathy Wills 2004-05-14 14:53:21 UTC
I have -mtune=i686 in my /etc/make.conf so I don't know why the mention that -mcpu is deprecated. Here is a little more information regarding this make error:

`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
mv -f portableio.o portableio.lo
/bin/sh ../../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../../include   -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES  -Wall -Wno-unused -I../../../include  -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c psymodel.c
gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES -Wall -Wno-unused -I../../../include -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c psymodel.c  -fPIC -DPIC
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
mv -f parse.o parse.lo
/bin/sh ../../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../../include   -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES  -Wall -Wno-unused -I../../../include  -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c quantize.c
gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES -Wall -Wno-unused -I../../../include -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c quantize.c  -fPIC -DPIC
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
mv -f quantize.o quantize.lo
/bin/sh ../../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../../include   -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES  -Wall -Wno-unused -I../../../include  -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c quantize-pvt.c
gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES -Wall -Wno-unused -I../../../include -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c quantize-pvt.c  -fPIC -DPIC
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
mv -f psymodel.o psymodel.lo
/bin/sh ../../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../../include   -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES  -Wall -Wno-unused -I../../../include  -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c vbrquantize.c
gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES -Wall -Wno-unused -I../../../include -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c vbrquantize.c  -fPIC -DPIC
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
mv -f vbrquantize.o vbrquantize.lo
/bin/sh ../../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../../include   -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES  -Wall -Wno-unused -I../../../include  -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c reservoir.c
quantize-pvt.c: In function `quantize_xrpow':
quantize-pvt.c:978: error: PIC register `%ebx' clobbered in `asm'
make[3]: *** [quantize-pvt.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -DLAMEPARSE -DNDEBUG -D__NO_MATH_INLINES -Wall -Wno-unused -I../../../include -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c reservoir.c  -fPIC -DPIC
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
mv -f reservoir.o reservoir.lo
make[3]: Leaving directory `/var/tmp/portage/avifile-0.7.38.20030710/work/avifile-0.7-0.7.38/plugins/libmp3lame_audioenc/lame3.70'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/tmp/portage/avifile-0.7.38.20030710/work/avifile-0.7-0.7.38/plugins/libmp3lame_audioenc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/avifile-0.7.38.20030710/work/avifile-0.7-0.7.38/plugins'
make: *** [all-recursive] Error 1
 
!!! ERROR: media-video/avifile-0.7.38.20030710 failed.
!!! Function src_compile, Line 149, Exitcode 2
!!! (no error message)

Here is my emerge info:

 emerge info
Portage 2.0.50-r6 (default-x86-1.4, gcc-3.4.0, glibc-2.3.3_pre20040420-r0, 2.6.6-love1)
=================================================================
System uname: 2.6.6-love1 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.12
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium3 -mtune=i686 -O2 -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
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 /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/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium3 -mtune=i686 -O2 -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ http://mirror.clarkson.edu/pub/distributions/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/bmg-main"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="X alsa apm avi berkdb cdr crypt cups doc encode esd foomaticdb gdbm gif gimp gimp-print gnome gtk gtk2 imlib java jpeg libg++ libwww mad mikmod motif mozilla mpeg ncurses nls nptl oggvorbis opengl oss pam pdflib perl png python quicktime readline samba sdl slang spell ssl svga tcltk tcpd tetex truetype x86 xml2 xmms xv zlib"

I sure hope we can get this resolved.
Comment 2 Sebastian Dröge 2004-05-18 04:31:12 UTC
Same here with gcc 3.4.0-r2
Comment 3 ecco 2004-05-19 09:59:24 UTC
Created attachment 31708 [details, diff]
avifile-0.7.38.20030710-gcc-3.4.patch

I fixed the clobbered ebx register by replacing it with edx.

After this you get a list of unresolved symbols due to the changes in
unit-at-a-time compilation: unreferenced static variables and functions are
removed, this may result in undefined references when an asm statement refers
to the variable/function directly.

Fixed this by using __attribute__((used)) to make sure the variables are not
removed.

With these changes avifile compiles cleanly, and as far as I can tell
everything works.
Comment 4 Kathy Wills 2004-05-19 17:21:55 UTC
With this patch it finally compiled on my system too.
Comment 5 ares 2004-05-19 19:16:57 UTC
For `-mcpu=' is deprecated edit ebuild and type :

src_unpack() {
	unpack ${A}
	use qt || sed -i 's/qt[a-z]*//g' ${S}/samples/Makefile.am
	sed -i 's/mcpu/mtune/' ${S}/Makefile.am
	sed -i 's/mcpu/mtune/' ${S}/configure.in
Comment 6 Robert Moss (RETIRED) gentoo-dev 2004-05-20 03:29:00 UTC
Again using that creates an error with gcc versions <3.4, so this patch should be applied conditionally.
Comment 7 ecco 2004-05-21 11:04:04 UTC
How silly, thanks for mentioning that :)

Actually, I believe __attribute__((used)) was implemented in gcc-3.1, so unless for some reason someone is using < gcc-3.1 it shouldn't be a problem?
Comment 8 ecco 2004-05-21 11:09:56 UTC
Never mind, it could only be used as a function attribute, and not for variables. Sorry about that.
Comment 9 Travis Tilley (RETIRED) gentoo-dev 2004-05-21 22:06:43 UTC
gcc 3.1 implements the used attribute for variables, 3.4 for functions.

you can easily make code compatible for function declarations with:

#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
#define __attribute_function_used__     __attribute__((__used__))
#else
#define __attribute_function_used__     __attribute__((__unused__))
#endif

and then use __attribute_function_used__ instead of __attribute__((__used__)) for functions. you can do something similar for variables, only with __GNUC_MINOR__ >= 1.

as for fixing avifile, it works on amd64... so it would be a pain to actively test patches for x86, any any complete patches would likely conflict with the one i already use. i'm on amd64 and dont hit any of this asm, so an additional patch would probably just need to touch on the assembly. take a look at /usr/portage/media-video/avifile/files/avifile-gcc34.patch
Comment 10 Travis Tilley (RETIRED) gentoo-dev 2004-05-21 22:07:39 UTC
typo: that should be >=4
Comment 11 ecco 2004-05-23 11:23:25 UTC
I do believe it's the other way around:

http://gcc.gnu.org/onlinedocs/gcc-3.1.1/gcc/Function-Attributes.html#Function%20Attributes
http://gcc.gnu.org/onlinedocs/gcc-3.1.1/gcc/Variable-Attributes.html#Variable%20Attributes

And the patch doesn't conflict with any of the other patches in portage, including the amd64 one. But if you want I could rewrite the above patch to be conditional on the gcc version if anyone wants it :)
Comment 12 Wilbur Pan 2004-05-27 06:57:29 UTC
The patch applied cleanly for me, but I get the following error:

c++ -DHAVE_CONFIG_H -I. -I. -I../include  -I/usr/qt/3/include -I/usr/include/SDL -D_REENTRANT -I/usr/X11R6/include      -I../libavqt    -DQT_THREAD_SUPPORT    -DPIXMAP_PATH=\"/usr/share/avifile-0.7/pixmaps\" -Wall -Wno-unused -I../include  -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -c configdialog_impl.cpp
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
/bin/sh ../libtool --mode=link c++  -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe  -o aviplay  actioncfg.o main.o playercontrol.o decoder_config.o configdialog.o configdialog_impl.o ../libavqt/libqavm.la        -L/usr/qt/3/lib -lqt-mt        ../lib/libaviplay.la     -Wl,-rpath,/usr/lib -lSDL -lpthread -L/usr/X11R6/lib  -lSM -lICE -lXinerama -lXv -lXxf86vm -lXxf86dga -lXi  -lXext -lX11   -lnsl -ldl
mkdir .libs
c++ -O2 -mcpu=i686 -march=i686 -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -pipe -o .libs/aviplay actioncfg.o main.o playercontrol.o decoder_config.o configdialog.o configdialog_impl.o -Wl,-rpath -Wl,/usr/lib  ../libavqt/.libs/libqavm.so -L/usr/qt/3/lib -L/usr/X11R6/lib /usr/qt/3/lib/libqt-mt.so /usr/lib/libmng.so /usr/lib/libjpeg.so -lpng -lXrandr ../lib/.libs/libaviplay.so -L/usr/i686-pc-linux-gnu/bin -L/usr/i686-pc-linux-gnu/lib -L/usr/lib/gcc/i686-pc-linux-gnu/3.4.0 -L/usr/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/lib -lXft -lXrender /usr/lib/libfontconfig.so /usr/lib/libfreetype.so -lz /usr/lib/libexpat.so /usr/lib/libSDL.so /usr/lib/gcc/i686-pc-linux-gnu/3.4.0/libstdc++.so -lgcc_s -lc /usr/lib/libasound.so -lm -lvga -lpthread -lSM -lICE -lXinerama -lXv -lXxf86vm -lXxf86dga -lXi -lXext -lX11 -lnsl -ldl -Wl,--rpath -Wl,/usr/qt/3/lib -Wl,--rpath -Wl,/usr/lib/gcc/i686-pc-linux-gnu/3.4.0
../lib/.libs/libaviplay.so: undefined reference to `wm0101'
../lib/.libs/libaviplay.so: undefined reference to `wm1010'
../lib/.libs/libaviplay.so: undefined reference to `wm1100'
../lib/.libs/libaviplay.so: undefined reference to `magicF2W'
collect2: ld returned 1 exit status
make[1]: *** [aviplay] Error 1
make[1]: Leaving directory `/home/var/tmp/portage/avifile-0.7.38.20030710/work/avifile-0.7-0.7.38/player'
make: *** [all-recursive] Error 1

!!! ERROR: media-video/avifile-0.7.38.20030710 failed.
!!! Function src_compile, Line 149, Exitcode 2
!!! (no error message)

-------------------------
# emerge info
Portage 2.0.50-r6 (default-x86-1.4, gcc-3.4.0, glibc-2.3.3_pre20040420-r1, 2.6.6-mm5)
=================================================================
System uname: 2.6.6-mm5 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.15
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium3 -O2 -mno-align-stringops -minline-all-stringops -fno-crossjumping -fmove-all-movables -mno-push-args -fno-delayed-branch -fno-thread-jumps -fno-defer-pop -Wall -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium3 -O2 -mno-align-stringops -minline-all-stringops -fno-crossjumping -fmove-all-movables -mno-push-args -fno-delayed-branch -fno-thread-jumps -fno-defer-pop -Wall -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://128.213.5.34/gentoo/ http://open-systems.ufl.edu/mirrors/gentoo ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://ftp6.uni-erlangen.de/pub/mirrors/gentoo http://gentoo.eliteitminds.com ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo http://ftp.heanet.ie/pub/gentoo/ http://gentoo.llarian.net/ http://gentoo.binarycompass.org http://gentoo.tiscali.nl/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/home/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X acpi acpi4linux alsa apm arts avi berkdb bindist bonobo cdr crypt cups curl dga dvb dvd encode esd fam foomaticdb gcj gdbm gif gimpprint gpm gtk2 imap imlib imlib2 ipv6 java javamail jpeg kde ldap libg++ libwww live mad mikmod mmx motif mpeg music ncurses nls nptl objc oggvorbis opengl oss pam pcmcia pda pdflib perl pic png python qt quicktime rage128 readline samba sdl slang slp spell sse ssl svga tcpd tiff truetype usb x86 xml2 xmms xv zlib"
Comment 13 Wilbur Pan 2004-05-27 07:18:59 UTC
Ack.  Sorry.  Please ignore the previous bug filing.  Tried it again, and it worked.
Comment 14 Travis Tilley (RETIRED) gentoo-dev 2004-05-29 14:04:25 UTC
wow. dont mind me, brain fart. applied patch to cvs, someone on x86 can yell at me if it breaks :)