Need help/instructions to build ffmpeg with libdav1d under Windows
Hello,
I am asking for help because I cannot build ffmpeg with the AV1 decoding library "libdav1d".
I am under Windows 10.
I can build ffmpeg without "libdav1d". To do so, I use msys 1.0.
In msys 1.0, I type:
./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-shared
make
and it works fine: I can buid ffmpeg in x64 mode. With a slightly different ./configure line, I can also build it in win32 mode.
But then I try to include libdav1d like this:
./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-shared --enable-libdav1d
and it fails, with this error message:
ERROR: dav1d >= 0.5.0 not found using pkg-config
So I tried 2 different approach:
- I downloaded the source code of libdav1d from https://code.videolan.org/videolan/dav1d and I tried to compile it
- I also downloaded the already built libraries (for win 64 and win 32) from https://code.videolan.org/videolan/dav1d
*** Concerning the 1st approach (build libdav1d from its source code), I have seen that I need to install meson, ninja and nasm.
I have seen somewhere that I should use msys 2.0 to do that, so I install msys 2.0 and run it.
Then I follow the instructions indicated on https://code.videolan.org/videolan/dav1d
But when I run ninja, I get compilation errors like this :
$ 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...>
And when I try to reconfigure meson, I get this error:
$ 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
I have also tried to copy cl.exe and link.exe from Visual Studio 2010 in the msys 2.0 bin\ folder (replacing the already present link.exe) but I had no success doing that.
*** Concerning the 2nd approach, (build libdav1d from its source code), I have seen that I need to install meson, ninja and nasm.
I download the zip containing the already built libraries of libdav1d from https://code.videolan.org/videolan/dav1d
Then I created a folder ffmpeg/libdav1d and I copied the bin, include\ and lib\ folders from the zip in this ffmpeg/libdav1d folder.
Then in msys 1.0, I run ./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-shared --enable-libdav1d
But then I get this error:
ERROR: dav1d >= 0.5.0 not found using pkg-config
If I understand correctly, the problem comes from the fact that pkg-config doesn't know where to find dav1d (even if it is in ffmpeg/libdav1d, like the other ffmpeg libraries ffmpeg/libavcodec, ffmpeg/libavdevice, ffmpeg/libavformat, ...)
So I looked for a solution to tell pkg-config where libdav1d is.
echo $PKG_CONFIG_PATH
returns an empty reply
so I defined the environment variable PKG_CONFIG_PATH as it is defined in my msys 2.0 by typing: export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig
But since these folders don't exist in my msys 1.0, I created this folder (in Windows)
C:\MinGW\msys\1.0\share\pkgconfig
and in this folder, I copied the file "dav1d.pc" and I modify the first line of this file (the value of variable prefix):
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}
But when I use ./configure, I keep having this error message: ERROR: dav1d >= 0.5.0 not found using pkg-config
So here is my question:
Could someone give me step by step instructions to build (under Windows) ffmpeg with libdav1d ?
If possible, I would prefer to build libdav1d and include it in ffmpeg rather than use libdav1d already built by someone else.
Thanks in advance!