[FFmpeg-user] Loading shared libraries in macOS
Moritz Barsnick
barsnick at gmx.net
Wed Aug 12 18:52:04 EEST 2020
On Wed, Aug 12, 2020 at 18:01:54 +0300, Aleksid wrote:
> I need to link FFmpeg the shared libraries in my app and also use ffmpeg
> executable. Both programs should link dylibs. So impossible to use static
> linking.
It's not specifically an ffmpeg question, but perhaps your ffmpeg
libav* libraries are the first ones you need to "bundle".
I come from a world of ELF binary format, but I found out that you can
achieve the same thing with Mac OS.
The binary program which references the dynlibs can be provided with a
"run path", usually called RPATH, RUN_PATH, LC_RPATH or the likes,
telling the program loader where to (additionally) search for the
required dependent dynlibs.
On ELF systems, you can provide an RPATH with a literal "$ORIGIN"
component, telling the loader to look into the same directory as the
program. You can set/amend the RPATH during the linking process, or
change it using tools such als "patchelf", "chrpath", or possibly
something from elfutils.
On Mac OS, I figured out that the corresponding command for its binary
format is "install_name_tool". Here's some info explaining its uses:
https://medium.com/@donblas/fun-with-rpath-otool-and-install-name-tool-e3e41ae86172
And a thread touching this is here, with this particular answer:
https://stackoverflow.com/a/44796519
Good luck! (I don't have Mac OS.)
> names? How can I guess about version 4.1, 4.2 or 4.3? If another program
> will rewrite these dylibs, and I'll get an older version of FFmpeg libs?
> It's another kind of dylib hell.
You are supposed to have good control of which programs write stuff
destroying your efforts. ;-)
Cheers,
Moritz
More information about the ffmpeg-user
mailing list