繁体   English   中英

为 ffmpeg 编译 libsrt 时出现问题,使用 pkg-config 找不到库

[英]Problem compiling libsrt for ffmpeg, library not found using pkg-config

我正在尝试从源构建 ffmpeg 和依赖项(因为它将在 aws 上的容器中使用),但我很难使用 ffmpeg 和 pkg-config。

我编译 static 库,其中 libsrt 来自源并将生成的文件放入定义明确的目录。 pkg-config 发现 srt 没有问题,但 ffmpeg 由于某种原因没有找到(参见下面的 output)。

这是它的样子:

构建代码(我提取了有趣的部分,也构建了其他库,我添加了打印以查看发生了什么):

echo "*** Building libsrt ***"
cd $BUILD_DIR/srt*
make distclean
PKG_CONFIG_PATH="$TARGET_DIR/lib/pkgconfig" \
  PATH="$BIN_DIR:$PATH" \
    cmake -G "Unix Makefiles" \
    -DCMAKE_INSTALL_PREFIX="$TARGET_DIR" \
    -DCMAKE_INSTALL_LIBDIR="$TARGET_DIR/lib" \
    -DCMAKE_INSTALL_INCLUDEDIR="$TARGET_DIR/include" \
    -DCMAKE_INSTALL_BINDIR="$BIN_DIR" \
    -DENABLE_SHARED:bool=off \
    -DENABLE_C_DEPS:bool=on \
    -DENABLE_STATIC:bool=on
make -j $jval
make install
echo '========================================================================'
pwd
echo "$TARGET_DIR"
echo "$BUILD_DIR"
echo 'target_dir=' && ls "$TARGET_DIR"
echo 'lib=' && ls "$TARGET_DIR/lib"
echo 'lib/pkgconfig=' && ls "$TARGET_DIR/lib/pkgconfig"
echo 'bin_dir=' && ls "$BIN_DIR"
echo 'include=' && ls "$TARGET_DIR/include"
echo 'path=' && echo $PATH
pkg-config --modversion srt
export PKG_CONFIG_PATH="$TARGET_DIR/lib/pkgconfig":$PKG_CONFIG_PATH


echo "*** Building FFmpeg ***"
cd $BUILD_DIR/FFmpeg*
make distclean
PATH="$BIN_DIR:$PATH" \
  ./configure \
    --prefix="$TARGET_DIR" \
    --pkg-config-flags="--static" \
    --extra-cflags="-I$TARGET_DIR/include -I$TARGET_DIR/usr/local/include -I/usr/local/cuda/include" \
    --extra-ldflags="-L$TARGET_DIR/lib -L$TARGET_DIR/usr/local/lib -L/usr/local/cuda/lib64" \
    --extra-libs="-Wl,-Bstatic -lharfbuzz -lfreetype -lpng -lz -lbz2 -Wl,-Bdynamic -lm -ldl -lpthread -lsrt -lssl -lcrypto" \
    --extra-ldexeflags="-Wl,-Bstatic" \
    --nvccflags="-gencode arch=compute_75,code=sm_75 -O2" \
    --bindir="$BIN_DIR" \
    --enable-pic \
    --enable-ffplay \
    --enable-fontconfig \
    --enable-frei0r \
    --enable-gpl \
    --enable-version3 \
    --enable-libass \
    --enable-libfribidi \
    --enable-libfdk-aac \
    --enable-libfreetype \
    --enable-libmp3lame \
    --enable-libopenjpeg \
    --enable-libopus \
    --enable-libsoxr \
    --enable-libspeex \
    --enable-libtheora \
    --enable-libvidstab \
    --enable-libvorbis \
    --enable-libvpx \
    --enable-libwebp \
    --enable-libx264 \
    --enable-libx265 \
    --enable-libxvid \
    --enable-libzimg \
    --enable-nonfree \
    --enable-openssl \
    --enable-cuda-nvcc \
    --enable-cuvid \
    --enable-nvenc \
    --enable-libsrt \
    --enable-libnpp || tail -n 100 ${HOME}/build/FFmpeg*/ffbuild/config.log

PATH="$BIN_DIR:$PATH" make -j $jval
make install

这是我在日志中打印的内容(我将 [...] 用于删除不相关的部分):

[...]
[100%] Built target srt-file-transmit
Install the project...
-- Install configuration: "Release"
-- Installing: /codebuild/output/ffmpeg/target/lib/libsrt.a
-- Installing: /codebuild/output/ffmpeg/target/include/srt/version.h
-- Installing: /codebuild/output/ffmpeg/target/include/srt/srt.h
-- Installing: /codebuild/output/ffmpeg/target/include/srt/logging_api.h
-- Installing: /codebuild/output/ffmpeg/target/include/srt/access_control.h
-- Installing: /codebuild/output/ffmpeg/target/include/srt/platform_sys.h
-- Installing: /codebuild/output/ffmpeg/target/include/srt/udt.h
-- Installing: /codebuild/output/ffmpeg/target/lib/pkgconfig/haisrt.pc
-- Installing: /codebuild/output/ffmpeg/target/lib/pkgconfig/srt.pc
-- Installing: /codebuild/output/ffmpeg/bin/srt-live-transmit
-- Up-to-date: /codebuild/output/ffmpeg/bin/srt-live-transmit
-- Installing: /codebuild/output/ffmpeg/bin/srt-file-transmit
-- Up-to-date: /codebuild/output/ffmpeg/bin/srt-file-transmit
-- Installing: /codebuild/output/ffmpeg/bin/srt-tunnel
-- Up-to-date: /codebuild/output/ffmpeg/bin/srt-tunnel
-- Installing: /codebuild/output/ffmpeg/bin/srt-ffplay
========================================================================
/codebuild/output/ffmpeg
/codebuild/output/ffmpeg/target
/codebuild/output/ffmpeg/build

target_dir=
bin
etc
include
lib
share
ssl
var

lib=
cmake
[...]
libsrt.a
libssl.a
[...]
pkgconfig

lib/pkgconfig=
[...]
haisrt.pc
[...]
libcrypto.pc
libssl.pc
[...]
openssl.pc
[...]
srt.pc
[...]

bin_dir=
[...]
srt-ffplay
srt-file-transmit
srt-live-transmit
srt-tunnel
[...]

include=
[...]
srt
[...]

path=
/root/.cargo/bin:/root/miniconda3/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/codebuild/user/bin
1.4.3
========================================================================
*** Building FFmpeg ***
ERROR: srt >= 1.3.0 not found using pkg-config

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
tail: cannot open '/root/build/FFmpeg*/ffbuild/config.log' for reading: No such file or directory

[Container] 2021/06/09 15:03:22 Command did not exit successfully ./build.sh exit status 1
[Container] 2021/06/09 15:03:22 Phase complete: BUILD State: FAILED
[Container] 2021/06/09 15:03:22 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: ./build.sh. Reason: exit status 1

知道有什么问题吗?

谢谢!

我已经在ffmpeg上使用 SRT 编译了debian ,使用

TLDR(可能没有必要):

brew install openssl srt
export CFLAGS="$(freetype-config --cflags) $CFLAGS"
export CPPFLAGS="-I$(brew --prefix openssl)/include $CPPFLAGS"
export LDFLAGS="-L$(brew --prefix openssl)/lib $(freetype-config --libs) $LDFLAGS"
export PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig"

我认为以上应该可行,但是如果您想弄清楚以下路线可能会有所帮助。

您可以在./ffbuild/config.log中找到提示,其中可能会说openssl未找到。

在 Mac 上,您可能已经通过brew获得了它,但由于 Mac 使用libressl ,因此无法链接到它,因此以下要求应满足ERROR: srt >= 1.3.0 not found using pkg-config消息:

brew install openssl srt
export LDFLAGS="$(freetype-config --libs)"    
export CFLAGS="$(freetype-config --cflags)"
export PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig"

也许是可选的。 也许不是:

  • CPPFLAGS可能是可选的。
  • 编译指南中对PKG_CONFIG_PATH的这些添加也可能是: /usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/opt/X11/lib/pkgconfig:$PKG_CONFIG_PATH

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM