Amongst a bunch of warnings, the following significant ones appear : gcc -Wall -O3 -march=athlon-xp -fomit-frame-pointer -ftracer -pipe -maccumulate-outgoing-args -fprefetch-loop-arrays -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o liba52/resample.o liba52/resample.c liba52/resample_mmx.c:10: warning: 'magicF2W' defined but not used liba52/resample_mmx.c:11: warning: 'wm1010' defined but not used liba52/resample_mmx.c:12: warning: 'wm0101' defined but not used liba52/resample_mmx.c:13: warning: 'wm1100' defined but not used Which causes the following errors later on : gcc -Wall -O3 -march=athlon-xp -fomit-frame-pointer -ftracer -pipe -maccumulate-outgoing-args -fprefetch-loop-arrays -I. -I/var/tmp/portage/ffmpeg-0.4.8.20040322/work/ffmpeg-20040322 -I/var/tmp/portage/ffmpeg-0.4.8.20040322/work/ffmpeg-20040322/libavcodec -I/var/tmp/portage/ffmpeg-0.4.8.20040322/work/ffmpeg-20040322/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o cmdutils.o cmdutils.c gcc -Wl,--warn-common -rdynamic -g -o ffmpeg_g ffmpeg.o cmdutils.o -L./libavformat -lavformat -L./libavcodec -lavcodec -lm -lz -ldl -logg -lvorbis -lvorbisenc ./libavcodec/libavcodec.so: undefined reference to `wm0101' ./libavcodec/libavcodec.so: undefined reference to `wm1010' ./libavcodec/libavcodec.so: undefined reference to `wm1100' ./libavcodec/libavcodec.so: undefined reference to `magicF2W' collect2: ld returned 1 exit status This is an ugly brute force approach though. I'm sure there's a perfectly reasonable way to modify libavcodec/liba52/resample_mmx.c to prevent the removal of the variables (I'm *sure* I read something about that in the last day or two) that doesn't eliminate an otherwise effective and valid optimisation. Reproducible: Always Steps to Reproduce: 1. emerge =sys-devel/gcc-3.4.0 2. emerge ffmpeg 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"
There's a bit missing in there... (too tired methinks) In between the error and the assertion of "an ugly brute force approach" should be a comment to the effect that adding -fno-unit-at-a-time to CFLAGS results in successful compilation.
Yup, use __attribute__((used)): * The new unit-at-a-time compilation scheme has several compatibility issues: + The order in which functions, variables, and top-level asm statements are emitted may have changed. Code relying on some particular ordering needs to be updated. The majority of such top-level asm statements can be replaced by section attributes. + Unreferenced static variables and functions are removed. This may result in undefined references when an asm statement refers to the variable/function directly. In that case either the variable/function shall be listed in asm statement operand or in the case of top-level asm statements the attribute used shall be used to force function/variable to be always output and considered as a possibly used by unknown code. For variables the attribute is accepted only by GCC 3.4 and newer, while for earlier versions it is sufficient to use unused to silence warnings about the variables not being referenced. To keep code portable across different GCC versions, you can use appropriate preprocessor conditionals. I'll attach the patch, but it looks like it needs to be applied conditional on the version of gcc used.
Created attachment 30465 [details, diff] 0.4.8-gcc3.4-magicF2W.patch Note: applying __attribute__((used)) to a variable is an error in gcc 3.3 and below. This patch needs to be conditionally applied, or expanded to use a #ifdef, on the version of gcc used.
i just tried out this patch and it works fine for me on x86
works on x86 here too, thanks
ffmpeg-0.4.8.20040322-r1.ebuild has just been released, without this patch being applied. Is there something wrong with the patch? Do you require more testing? We would appreciate being informed.
i will be working on this bug now, making sure it applies only conditionally for users of gcc 3.4.x as this patch was previously verified
give it a while then sync, ffmpeg-0.4.8.20040322-r1.ebuild will work with gcc-3.4.0