Build fails on Windows when using MSYS2
When you try to compile dav1d on the latest MSYS2 (using mingw-w64 gcc as the compiler) the build fails at the configuration phase with the following (cryptic) error in meson-log.txt (while the output asserts that it hasn't found nasm):
Configuring config.asm using configuration 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte Unusable script '/usr/bin/nasm' Program nasm found: NO
The error related to UTF-8 comes from Meson itself (it's a generic Python error code) and seems to stem from the fact that Meson/Python tries to interpret the NASM executable as a script (0x90 is the 3rd byte after the "MZ" magic number and seems to be a standard value in the MS-DOS stubs across compilers for almost every single PE file out there).
There's a workaround though: the error seems to manifest only in the 0.49.2 version of Meson (which is the one that gets installed by the pacman -S mason command) that seems to have this bug. The bug seems to have been fixed in subsequent versions of Mason so if a more recent version of Mason is installed using pip3 then the build completes without any errors. So the following needs to be run on MSYS2 to build dav1d correctly:
pacman -S mingw-w64-x86_64-python3-pip pip3 install meson meson.exe build --buildtype release