Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 49383 - ffmpeg-0.4.8.20040322 won't compile with gcc 3.4.0
Summary: ffmpeg-0.4.8.20040322 won't compile with gcc 3.4.0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Disenchanted (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 48528
  Show dependency tree
 
Reported: 2004-04-29 08:10 UTC by gent_bz
Modified: 2004-06-25 15:56 UTC (History)
4 users (show)

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


Attachments
0.4.8-gcc3.4-magicF2W.patch (0.4.8-gcc3.4-magicF2W.patch,993 bytes, patch)
2004-05-01 09:56 UTC, Ed Catmur
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description gent_bz 2004-04-29 08:10:49 UTC
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"
Comment 1 gent_bz 2004-04-29 08:16:22 UTC
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.
Comment 2 Ed Catmur 2004-05-01 09:53:26 UTC
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.
Comment 3 Ed Catmur 2004-05-01 09:56:05 UTC
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.
Comment 4 Bret Towe 2004-06-01 18:06:44 UTC
i just tried out this patch and it works fine for me on x86
Comment 5 Disenchanted (RETIRED) gentoo-dev 2004-06-05 15:44:04 UTC
works on x86 here too, thanks
Comment 6 Ed Catmur 2004-06-10 00:59:22 UTC
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.
Comment 7 Disenchanted (RETIRED) gentoo-dev 2004-06-25 13:58:47 UTC
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
Comment 8 Disenchanted (RETIRED) gentoo-dev 2004-06-25 15:56:00 UTC
give it a while then sync, ffmpeg-0.4.8.20040322-r1.ebuild will work with gcc-3.4.0