How to enable external libraries but do not depend on them

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to enable external libraries but do not depend on them

Taner Sener
Hi,


I’m building static libraries of ffmpeg with the following configure line.


./configure --enable-static --disable-shared --disable-doc
--disable-programs —enable-lib1 —enable-lib2 —enable-lib3 …


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, … . 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?


Thanks
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to enable external libraries but do not depend on them

Moritz Barsnick
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
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to enable external libraries but do not depend on them

Taner Sener
On Sun, 23 Dec 2018 at 18:00, Moritz Barsnick <[hidden email]> wrote:

> 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.
>

In fact, the first thing I tried was extracting all static libraries and
packing them again in a single static library. But I failed to link output
library in Xcode, I received too many undefined symbol errors. I use link
time optimization & bitcode embedding flags for ffmpeg compilation. Maybe
this extract & re-pack process broke them. I'm not sure. I still didn't
give up but it would be great if I had another option.

> 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.

Yes, I have a wrapper library around it. It works well.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".