[FFmpeg-user] Static compile with embeded 3rd party libraries.

Thomas Worth dev at rarevision.com
Thu Aug 25 23:57:16 CEST 2011


On Thu, Aug 25, 2011 at 9:28 AM, Tim Nicholson <tim.nicholson at bbc.co.uk> wrote:
> Having been building ffmpeg statically for a while to avoid conflicts with
> distro versions by using:-
>
> "... --enable-static --disable-shared ..."
>
> I want to go one step further and end up with a portable executable that
> also includes all the third party libs such as lame faac etc. Googling
> around suggests adding in:-
>
> "--extra-libs=-static --extra-cflags=--static"
>
> However when I do this configure fails with an error saying it cannot find
> the third party libs.

I've found that I don't need --extra-libs=-static or
--extra-cflags=--static if compiling third-party libs with
--disable-shared. Since a .dylib (Mac OS X) is not generated, gcc by
default compiles statically with the .a version of the library.

I have to give the path to the library for this to work, which
sometimes is put in a hidden directory. Here's an example:

$ cd /libfaac
$ ./configure --enable-static --enable-shared=no --without-mp4v2
--build=x86_64-apple-darwin10
$ make

This compiles and puts libfaac.a in /libfaac/.libs/libfaac.a (yes,
that's a dot in front of libs)

Since I don't do "make install," I must specify the absolute path to
the lib in ffmpeg's configure line:

$ cd /ffmpeg
$ ./configure $CONFIG_STUFF --extra-cflags=-I/libfaac/include
--extra-ldflags=-L/libfaac/.libs
$ make

That should generate a static binary that includes libfaac.


>
> "gcc -o /tmp/ffconf.kNbWfR0S /tmp/ffconf.htm52E9X.o -lfaac -lm -pthread
> -static
> /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:
> cannot find -lfaac
> collect2: ld returned 1 exit status
> ERROR: libfaac not found"
>
> I am obviously missing a bit, as it links to them fine without the extra two
> options. Can anyone assist in pointing me in the right direction?
>
> --
> Tim
>
> http://www.bbc.co.uk/
> This e-mail (and any attachments) is confidential and may contain personal
> views which are not the views of the BBC unless specifically stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in reliance
> on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list