[FFmpeg-user] How to enable external libraries but do not depend on them

Moritz Barsnick barsnick at gmx.net
Sun Dec 23 20:00:40 EET 2018


On Sun, Dec 23, 2018 at 17:20:32 +0000, Taner Sener wrote:
> When make completes I have libavcodec.a, libavdevice.a, libavfilter.a,
> libavformat.a, libavutil.a, libswresample.a, libswscale.a static ibraries.
> But they depend on enabled libraries lib1.a, lib2.a, lib3.a, … .

That's quite normal. in other word the expected result.

> Is it possible to specify a flag so that ffmpeg static libraries will
> include enabled libraries lib1.a, lib2.a, etc. but will not depend on
> them. So I won’t need them (external libraries) to distribute ffmpeg,
> which would be easier for me?

You can't with the normal tool chain, but you can use some "tricks" to
combine them, assuming you know all the dependencies:

https://stackoverflow.com/q/2157629

As it mentions, your resulting library will contain *everything* from
the dependencies. And the ffmpeg build process won't help you, *but*
the pkg-config files can tell you which libraries are the dependencies
of each ffmpeg library.

You could even omit e.g. libc, assuming it is always available on the
target.

Only when linking a *binary* will the linker throw away the unneeded
symbols. I don't know of an easy way to do this for your bundled
library (though there may be a way).

Do you really plan to distibute such bundled libraries - not binaries?
With binaries (i.e. executables), no such problem exists.

Moritz


More information about the ffmpeg-user mailing list