[Ffmpeg-devel] mp3lame : more --as-needed woes

Uoti Urpala uoti.urpala
Tue Oct 31 23:41:24 CET 2006

On Tue, 2006-10-31 at 17:40 -0500, Rich Felker wrote:
> On Mon, Oct 30, 2006 at 10:50:04AM +0100, Baptiste Coudurier wrote:
> > gcc -Wl,--warn-common -Wl,--as-needed -pthread -o
> > /tmp/ffmpeg-conf-15632-14573-3945 /tmp/ffmpeg-conf-6857-14573-19654.o
> > -lm -lz -ldts -lm -lmp3lame -lm
> > /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/libmp3lame.so:
> > undefined reference to `pow'
> > collect2: ld returned 1 exit status

> My guess is that these binutls are broken and decide that -lm is
> unneeded the first time they see it, then don't even consider it the
> second time they see it... As usual, blame the maintainers. In the

AFAICT the linker is behaving correctly here. From the ld man page
description of --as-needed: "Normally, the linker will add a DT_NEEDED
tag for each dynamic library mentioned  on  the  command line,
regardless of whether the library is actually needed.  --as-needed
causes DT_NEEDED tags to only be emitted for libraries that satisfy some
symbol reference from regular objects which is undefined at the point
that the library was linked.". Thus if the only references to libm
functions are in libmp3lame then the linker does the right thing when it
doesn't add a direct dependency from from the resulting binary to libm.

The error above means that the system has a broken libmp3lame.so. It
should depend on libm instead of relying on the main program to link
libraries providing the needed symbols.

More information about the ffmpeg-devel mailing list