处理 FFMPEG 依赖

Handle FFMPEG dependency

我正在开发一个 application (using the Qt framework that has several dependencies like ffmpeg. Since I'm mostly developping for the MacOS plateform, I use Homebrew 来管理我的依赖项,例如 ffmpeg

因此,当酿造配方发生变化时,我遇到了意外 API 变化的问题。

Homebrew 维护者建议我通过 brew 处理依赖项是一种不好的做法。所以我想知道最好的选择是什么?

我正在考虑添加 ffmpeg 作为我项目的子模块。你对此有何看法?

如果您需要某些与默认提供的库冲突的特定版本,那么

uninstall current release

download source of desired release https://ffmpeg.org/download.html#releases

decompress source code into some location then cd into there

自己发

./configure 

仔细检查输出,如果没有 ERROR 的迹象并且它正确地找到了上游库,那么你自己发出以下命令之一

make       # only uses one CPU core still works but slower than -jxxx
make -j4   # to speed up make and you have a dual core CPU
make -j8   # to speed up make and you have a quad core CPU

现在检查 make for 和 errors 的输出...您通常可以忽略编译警告...如果一切正常,则发出 (linux/OSX)

sudo make install

这会将库和可执行文件分发到标准位置,这些位置对于下游应用程序的后续 linking 是可见的

现在您可以像往常一样将您的下游代码编译到 link 到您从 ffmpeg(有很多)新分发的库

以上是最简单的情况,因为您已经安装了编译源代码所需的开发人员实用程序(编译器、linkers、...)

如果由于缺少或不正确的上游库版本而导致上述失败,请首先重复类似的步骤,然后 return 返回编译 ffmpeg(递归下降到库依赖安装疯狂)...我发现在 linux 上编译大量开源库比 OSX 更容易、更标准化 ... YMMV