如何防止ffmpeg版本冲突-Linux版—FFmpeg魔改教程

本文主要讲解如何在一个项目里面使用多个版本 FFmpeg 的库。但是在此之前,我们需要先讲解一下 gcc 的 soname 选项。

在之前的《Linux环境编译动态库》一文,我们已经知道了在 Linux 环境如何生成动态库,命令如下:

gcc -fPIC -shared -o libstar.so sun.o moon.o earth.o

上面这个命令是没有使用 soname 选项的,只是用 -o 指定了输出的动态库文件名,注意这个 libstar.so 只是一个文件名,并不是真正的 动态库名称。

我们现在加上 soname 选项,再生成一次 libstar 动态库,命令如下:

gcc -fPIC -shared -Wl,-soname,libstar666.so -o libstar.so sun.o moon.o earth.o

因为 soname 是链接器的选项,所以上面的命令 -Wl 是传递 选项给 链接器 的,他的用法如下:

-Wl,option

Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes -Map output.map to the linker. When using the GNU linker, you can also get the same effect with `-Wl,-Map=output.map'.

下面是 VIP会员专属 内容,购买后即可查看

版权所属 xianwanzhiyin.net 罗上文 2023 all right reserved,powered by Gitbook该文件修订时间: 2023-05-17 14:29:34

results matching ""

    No results matching ""