[Ffmpeg-devel] Problems linking libraries into ffmpeg

Diamond Software diamondsw
Sat May 13 20:44:12 CEST 2006

Hello, all. I've got one hopefully simple question regarding linking  
in support libraries like lame, faac, and faad. My platform is Mac OS  
X on Intel, but before you groan, I have mmx disabled (for now - I'll  
come back to that when I have the simple things done).

I have downloaded the source for these to folders within the main  
ffmpeg folder, so all paths are from ffmpeg/. I'm also trying to  
compile ffmpeg without superuser privileges, so all header files and  
libraries are left wherever they were when "make" for those  
individual packages completed; i.e. they won't be in /usr/local or  
any of the standard paths.

When I go to make ffmpeg, my current method is this (using CVS code,  
and all other support libraries already built):

CFLAGS="-I`pwd`/faac/include/ -I`pwd`/faad/include/ -I`pwd`/ 
lame-3.96.1/include/" \
CPPFLAGS="-I`pwd`/faac/include/ -I`pwd`/faad/include/ -I`pwd`/ 
lame-3.96.1/include/" \
LDFLAGS="-L`pwd`/faac/libfaac/.libs/ -L`pwd`/faad/libfaad/.libs/ - 
L`pwd`/lame-3.96.1/libmp3lame/.libs/" \
./configure --enable-static --disable-shared --disable-mmx --enable- 
gpl \
--disable-vhook --disable-ffplay --disable-ffserver --enable-pthreads \
--enable-a52 --enable-amr_nb --enable-amr_wb --enable-faac --enable- 
faad \
--extra-cflags=-DHAVE_LRINTF --enable-mp3lame && make

What then happens is compilation proceeds normally thanks to the  
CFLAGS and CPPFLAGS, but linking fails as the LDFLAGS are ignored. I  
finish up with an error like this:

cc -Wl,-dynamic,-search_paths_first -g -o ffmpeg_g ffmpeg.o  
cmdutils.o -L./libavformat -lavformat -L./libavcodec -lavcodec -L./ 
libavutil -lavutil -lfaac -lfaad -lmp3lame -lz -lpthread
/usr/bin/ld: can't locate file for: -lfaac
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1

If I manually edit each link to add the proper paths in, it works,  
but that's damn tedious:

cc -Wl,-dynamic,-search_paths_first -g -o ffmpeg_g ffmpeg.o cmdutils.o \
-L./libavformat -lavformat -L./libavcodec -lavcodec -L./libavutil - 
lavutil \
-L./faac/libfaac/.libs -lfaac \
-L./faad/libfaad/.libs -lfaad \
-L./lame-3.96.1/libmp3lame/.libs -lmp3lame \
-lz -lpthread
cc -Wl,-dynamic,-search_paths_first -g -o output_example  
output_example.o \
-L./libavformat -lavformat -L./libavcodec -lavcodec -L./libavutil - 
lavutil \
-L./faac/libfaac/.libs -lfaac \
-L./faad/libfaad/.libs -lfaad \
-L./lame-3.96.1/libmp3lame/.libs -lmp3lame \
-lz -lpthread

So - how can I get the proper paths sent to the linker? It's probably  
something really simple, but I'm missing it.


  - Joshua Ochs

[As an aside, is there a reason that the file libavcodec/ 
mp3lameaudio.c uses a header of <lame/lame.h>, rather than the usual  
"lame.h"? That unfortunately messes with my include paths above.]

More information about the ffmpeg-devel mailing list