首页 > 解决方案 > 错误:使用 pkg-config 找不到 dav1d >= 0.2.1

问题描述

我正在尝试使用 dav1d 构建 ffmpeg。我已经使用以下命令成功构建了 davit:

git clone --depth=1 https://code.videolan.org/videolan/dav1d.git && \
cd dav1d && \
mkdir build && cd build && \
meson .. && \
ninja

之后,我正在为 FFmpeg 运行配置命令并收到错误消息:

PKG_CONFIG_PATH="/app/ffmpeg_build/lib/pkgconfig" ./configure \
    --prefix="/app/ffmpeg_build" \
    --pkg-config-flags="--static" \
    --extra-cflags="-I/app/ffmpeg_build/include" \
    --extra-ldflags="-L/app/ffmpeg_build/lib" \
    --extra-libs="-lpthread -lm" \
    --bindir="/usr/local/bin" \
    --enable-gpl \
    --enable-libass \
    --enable-libmp3lame \
    --enable-libfreetype \
    --enable-libopus \
    --enable-libvorbis \
    --enable-libx264 \
    --enable-libdav1d \
    --enable-nonfree

(如果我省略了所有其他库,FFmpeg 会使用它们正确配置和构建--enable-libdav1d,但如果是上述命令,我会得到):

ERROR: dav1d >= 0.2.1 not found using pkg-config

我认为原因可能是介子将 bin 文件放在错误的目录中。有人可以帮忙吗?

PS 我使用的是 Ubuntu 18.04。

其他库的构建命令示例:

git -C x264 pull 2> /dev/null || git clone --depth 1 https://code.videolan.org/videolan/x264.git && \
cd x264 && \
PKG_CONFIG_PATH="/app/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/app/ffmpeg_build" --bindir="/usr/local/bin" --enable-static --enable-pic && \
make && \
make install

标签: linuxffmpegbuildninjameson-build

解决方案


要通过构建,您必须添加ninja install

git clone --depth=1 https://code.videolan.org/videolan/dav1d.git && \
cd dav1d && \
mkdir build && cd build && \
meson --bindir="/usr/local/bin" .. && \
ninja && \
ninja install

但这还不够,如果你之后运行 FFmpeg,你会得到:

ffmpeg: error while loading shared libraries: libdav1d.so.4: cannot open shared object file: No such file or directory

要解决此问题/usr/local/lib/x86_64-linux-gnu,请添加LD_LIBRARY_PATH

export LD_LIBRARY_PATH+=":/usr/local/lib/x86_64-linux-gnu"

推荐阅读