我正在寻求帮助,因为我无法使用 AV1 解码库“libdav1d”构建 ffmpeg。
我在 Windows 10 下。
我可以在没有“libdav1d”的情况下构建 ffmpeg。为此,我使用 msys 1.0。
在 msys 1.0 中,我输入:
./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-shared
make
它工作正常:我可以在 x64 模式下构建 ffmpeg。使用稍微不同的 ./configure 行,我也可以在 win32 模式下构建它。但后来我尝试像这样包含 libdav1d:
./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-shared --enable-libdav1d
它失败了,并显示以下错误消息:ERROR: dav1d >= 0.5.0 not found using pkg-config
所以我尝试了两种不同的方法:*** 关于第一种方法(从其源代码构建 libdav1d),我已经看到我需要安装介子、忍者和 nasm。
我在某处看到我应该使用 msys 2.0 来做到这一点,所以我安装了 msys 2.0 并运行它。
然后我按照 https://code.videolan.org/videolan/dav1d 上的说明进行操作
但是当我运行 ninja 时,会出现如下编译错误:
$ ninja
[1/161] Compiling C object src/libdav1d_bitdepth_8.a.p/cdef_tmpl.c.obj
FAILED: src/libdav1d_bitdepth_8.a.p/cdef_tmpl.c.obj
"cl" "-Isrc\libdav1d_bitdepth_8.a.p" "-Isrc" "-I..\src" "-I." "-I.." "-Iinclude\dav1d" "-I..\include\dav1d" "-Iinclude" "-I..\include" "-I..\include\compat\msvc" "-DNDEBUG" "/MD" "/nologo" "/showIncludes" "/W3" "/O2" "-D_POSIX_C_SOURCE=200112L" "-wd4028" "-wd4090" "-wd4996" "-DBITDEPTH=8" "/Fdsrc\libdav1d_bitdepth_8.a.p\cdef_tmpl.c.pdb" /Fosrc/libdav1d_bitdepth_8.a.p/cdef_tmpl.c.obj "/c" ../src/cdef_tmpl.c
..\include\common/attributes.h(133) : error C2054: '(' attendu après 'inline'
..\include\common/attributes.h(133) : error C2085: 'ctz' : ne figure pas dans la liste de paramètres formels
..\include\common/attributes.h(133) : error C2143: erreur de syntaxe : absence de ';' avant '{'
..\include\common/attributes.h(139) : error C2054: '(' attendu après 'inline'
..\include\common/attributes.h(139) : error C2085: 'clz' : ne figure pas dans la liste de paramètres formels
..\include\common/attributes.h(139) : error C2143: erreur de syntaxe : absence de ';' avant '{'
..\include\common/attributes.h(152) : error C2054: '(' attendu après 'inline'
<and many others...>
当我尝试重新配置介子时,我收到了这个错误:$ meson --reconfigure
The Meson build system
Version: 0.59.2
Source dir: /c/projects/ffmpeg44/dav1d
Build dir: /c/projects/ffmpeg44/dav1d/build
Build type: native build
Project name: dav1d
Project version: 0.9.2
C compiler for the host machine: cl (msvc 16.00.40219.01 "Compilateur d'optimisation Microsoft (R) 32�bits C/C++ version�16.00.40219.01 pour 80x86")
C linker for the host machine: link link 10.00.40219.01
../meson.build:25:0: ERROR: Unknown linker(s): [['lib'], ['llvm-lib']]
The following exception(s) were encountered:
Running "lib /?" gave "[Errno 2] No such file or directory: 'lib'"
Running "llvm-lib /?" gave "[Errno 2] No such file or directory: 'llvm-lib'"
A full log can be found at /c/projects/ffmpeg44/dav1d/build/meson-logs/meson-log.txt
我还尝试从 msys 2.0 bin\文件夹中的 Visual Studio 2010 复制 cl.exe 和 link.exe(替换已经存在的 link.exe),但我没有成功。*** 关于第二种方法,(从其源代码构建 libdav1d),我已经看到我需要安装 meson、ninja 和 nasm。
我从 https://code.videolan.org/videolan/dav1d 下载了包含已构建的 libdav1d 库的 zip。
然后我创建了一个文件夹 ffmpeg/libdav1d 并从这个 ffmpeg/libdav1d 文件夹中的 zip 中复制了 bin、include\和 lib\文件夹。
然后在 msys 1.0 中,我运行
./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-shared --enable-libdav1d
但后来我得到这个错误:ERROR: dav1d >= 0.5.0 not found using pkg-config
如果我理解正确,问题出在 pkg-config 不知道在哪里可以找到 dav1d(即使它在 ffmpeg/libdav1d 中,就像其他 ffmpeg 库 ffmpeg/libavcodec、ffmpeg/libavdevice、ffmpeg/libavformat、 ...)所以我寻找了一个解决方案来告诉 pkg-config libdav1d 在哪里。
echo $PKG_CONFIG_PATH
返回空回复所以我定义了环境变量 PKG_CONFIG_PATH,因为它是在我的 msys 2.0 中定义的:
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig
但由于这些文件夹在我的 msys 1.0 中不存在,我创建了这个文件夹(在 Windows 中)C:\MinGW\msys\1.0\share\pkgconfig
在这个文件夹中,我复制了文件“dav1d.pc”并修改了这个文件的第一行(变量前缀的值):prefix=/c/projects/ffmpeg44/ffmpeg/libdav1d
libdir=${prefix}/lib
includedir=${prefix}/include
Name: libdav1d
Description: AV1 decoding library
Version: 0.9.2
Libs: -L${libdir} -ldav1d
Cflags: -I${includedir}
但是当我使用 ./configure 时,我不断收到以下错误消息:ERROR: dav1d >= 0.5.0 not found using pkg-config
那么有人可以给我一步一步的说明来构建(在 Windows 下)ffmpeg 与 libdav1d 吗?如果可能的话,我宁愿构建 libdav1d 并将其包含在 ffmpeg 中,而不是使用其他人已经构建的 libdav1d。
提前致谢!
最佳答案
我可以使用这些介子标志在 MSYS 下使用 MinGW-w64 构建 dav1d 0.7.0:-Denable_tools=true -Denable_examples=false -Dfuzzing_engine=none -Denable_tests=false -Dtestdata_tests=false
制作 pkg-config
查找 .pc
文件,您应该添加包含 .pc
的文件夹文件到PKG_CONFIG_PATH
环境变量。
关于windows - 需要帮助/说明在 Windows 下使用 libdav1d 构建 ffmpeg,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69656803/