[FFmpeg-user] Can't build ffmpeg libs for Windows using msys2, msys1.0 or Debian 9.8

thomas l thomas.pontal at gmail.com
Tue Oct 26 00:02:30 EEST 2021


I have spent the last 3 days trying to build the ffmpeg 4.4 libraries
(avcodec.dll, avutil.dll, ...) for Windows.

I want to be able to build them for Windows 32 bits and for Windows 64 bits.

I want to build them with the maximum of libs included in it but I want to
stay within the LGPL license.

In particular, I want the libs to be able to decode AV1 and demux MPEG-DASH.

I have tried to build these libs under Windows (using msys 1, then msys 2)
and under Debian (cross-compilation to build Windows DLLs).

I think my closest attempt to success is when I use mingw / sys2

I do this:

- I run cmd from MSVC 10.0
- in the cmd window, I run msys : *msys2_shell.cmd -mingw64*

- in the msys2 window, I type:

export PATH="/c/Program Files (x86)/Microsoft Visual Studio

- then I go to the folder where I have unzipped the ffmpeg snapshot and I

*./configure --target-os=win64 --arch=x86_64 --toolchain=msvc
--enable-shared --enable-demuxer=dash*


*./configure --target-os=win64 --arch=x86_64 --toolchain=msvc
--enable-shared --enable-demuxer=dash --enable-cross-compile*

But I get this error:

*cl.exe is unable to create an executable file.If cl.exe is a
cross-compiler, use the --enable-cross-compile option.Only do this if you
know what cross compiling means.C compiler test failed.*

Even if I run only sudo ./configure --toolchain=msvc

I get the same error as above (in *bold*).

the ffbuild/config.log logfile contains this:

*BEGIN ./ffconf.vV44uHf2/test.c    1   int main(void){ return 0; }END
./ffconf.vV44uHf2/test.ccl.exe -nologo -c -Fo./ffconf.vV44uHf2/test.o
./ffconf.vV44uHf2/test.ctest.c./compat/windows/mslink -nologo
-out:./ffconf.vV44uHf2/test.exe ./ffconf.vV44uHf2/test.oLINK : error
LNK2001: symbole externe non r▒solu
mainCRTStartup./ffconf.vV44uHf2/test.exe : fatal error LNK1120: 1 externes
non r▒solusC compiler test failed.*

So I am wondering:

Could someone tell me what is wrong? How could I build the ffmpeg libraries
for Windows using msys2 ?

Thanks in advance!


PS: using msys 1.0, I always get this message:

* WARNING: Disabled dash_demuxer because not all dependencies are
satisfied: libxml2 *

even if libxml2 seems to be installed

And when I try to cross-compile under Debian 9.8, I get the error " *lib.exe
not found.*"

I think that the scripts expects to find the MSVC compiler/linker and since
we are now on Debian, they don't exist. I don't know how to fix that.

More information about the ffmpeg-user mailing list