media-autobuild_suite
media-autobuild_suite copied to clipboard
mingw64 libavif
18:04:25 ┌ libavif git .............................. [Recently updated]
18:04:26 ├ Running cmake...
18:04:28 ├ Running build...
Likely error (tail of the failed operation logfile):
C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexewin.c:67:(.text.startup+0xbd): undefined reference to WinMain' clang: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. [1/2] Linking C executable avifenc.exe FAILED: avifenc.exe cmd.exe /C "cd . && D:\ffmpeg-autobuild-clang\msys64\mingw64\bin\ccache.exe clang -D_FORTIFY_SOURCE=2 -fstack-protector-strong -march=znver2 -O3 -pipe -D__USE_MINGW_ANSI_STDIO=1 -Wno-implicit-function-declaration -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -fstack-protector-strong -march=znver2 -O3 -pipe -D__USE_MINGW_ANSI_STDIO=1 -Wno-implicit-function-declaration -static-libgcc --start-no-unused-arguments -static-libstdc++ --end-no-unused-arguments CMakeFiles/avifenc.dir/apps/avifenc.c.o -o avifenc.exe -Wl,--out-implib,libavifenc.dll.a -Wl,--major-image-version,0,--minor-image-version,0 libavif_apps.a libavif.a D:/ffmpeg-autobuild-clang/local64/lib/libdav1d.a D:/ffmpeg-autobuild-clang/local64/lib/librav1e.a -LD:/ffmpeg-autobuild-clang/local64/lib -lrav1e -lkernel32 -ladvapi32 -lbcrypt -lntdll -luserenv -lws2_32 -lkernel32 -ladvapi32 -lbcrypt -lntdll -luserenv -lws2_32 -Wl,--allow-multiple-definition D:/ffmpeg-autobuild-clang/local64/lib/libaom.a D:/ffmpeg-autobuild-clang/local64/lib/libsharpyuv.a -lm -lntdll -luserenv -lws2_32 -lbcrypt D:/ffmpeg-autobuild-clang/msys64/mingw64/lib/libpng.a D:/ffmpeg-autobuild-clang/msys64/mingw64/lib/libz.a D:/ffmpeg-autobuild-clang/msys64/mingw64/lib/libjpeg.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." D:/ffmpeg-autobuild-clang/msys64/mingw64/bin/ld: D:/ffmpeg-autobuild-clang/msys64/mingw64/lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o): in function
main':
C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexewin.c:67:(.text.startup+0xbd): undefined reference to `WinMain'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
I also have an error when reaching libavif, with an undefined reference to 'WinMain'
[35/38] Linking C static library libavif.a [36/38] Linking C static library libavif_apps.a [37/38] Linking C executable avifenc.exe FAILED: avifenc.exe cmd.exe /C "cd . && C:\ndi\mab\msys64\mingw64\bin\ccache.exe gcc -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++ CMakeFiles/avifenc.dir/apps/avifenc.c.o -o avifenc.exe -Wl,--out-implib,libavifenc.dll.a -Wl,--major-image-version,0,--minor-image-version,0 libavif_apps.a libavif.a C:/ndi/mab/local64/lib/libdav1d.a C:/ndi/mab/local64/lib/librav1e.a -LC:/ndi/mab/local64/lib -lrav1e -lkernel32 -ladvapi32 -lbcrypt -lntdll -luserenv -lws2_32 -lkernel32 -ladvapi32 -lbcrypt -lntdll -luserenv -lws2_32 -Wl,--allow-multiple-definition C:/ndi/mab/local64/lib/libaom.a C:/ndi/mab/local64/lib/libsharpyuv.a -lm -lntdll -luserenv -lws2_32 -lbcrypt C:/ndi/mab/local64/lib/libpng.a C:/ndi/mab/msys64/mingw64/lib/libz.a C:/ndi/mab/msys64/mingw64/lib/libjpeg.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." C:/ndi/mab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ndi/mab/msys64/mingw64/lib/../lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o): in function `main':
C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexewin.c:67:(.text.startup+0xbd): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status [38/38] Linking C executable avifdec.exe FAILED: avifdec.exe cmd.exe /C "cd . && C:\ndi\mab\msys64\mingw64\bin\ccache.exe gcc -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++ CMakeFiles/avifdec.dir/apps/avifdec.c.o -o avifdec.exe -Wl,--out-implib,libavifdec.dll.a -Wl,--major-image-version,0,--minor-image-version,0 libavif_apps.a libavif.a C:/ndi/mab/local64/lib/libdav1d.a C:/ndi/mab/local64/lib/librav1e.a -LC:/ndi/mab/local64/lib -lrav1e -lkernel32 -ladvapi32 -lbcrypt -lntdll -luserenv -lws2_32 -lkernel32 -ladvapi32 -lbcrypt -lntdll -luserenv -lws2_32 -Wl,--allow-multiple-definition C:/ndi/mab/local64/lib/libaom.a C:/ndi/mab/local64/lib/libsharpyuv.a -lm -lntdll -luserenv -lws2_32 -lbcrypt C:/ndi/mab/local64/lib/libpng.a C:/ndi/mab/msys64/mingw64/lib/libz.a C:/ndi/mab/msys64/mingw64/lib/libjpeg.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." C:/ndi/mab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ndi/mab/msys64/mingw64/lib/../lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o): in function `main':
C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexew logs.zip in.c:67:(.text.startup+0xbd): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed. [1/2] Linking C executable avifenc.exe FAILED: avifenc.exe cmd.exe /C "cd . && C:\ndi\mab\msys64\mingw64\bin\ccache.exe gcc -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++ CMakeFiles/avifenc.dir/apps/avifenc.c.o -o avifenc.exe -Wl,--out-implib,libavifenc.dll.a -Wl,--major-image-version,0,--minor-image-version,0 libavif_apps.a libavif.a C:/ndi/mab/local64/lib/libdav1d.a C:/ndi/mab/local64/lib/librav1e.a -LC:/ndi/mab/local64/lib -lrav1e -lkernel32 -ladvapi32 -lbcrypt -lntdll -luserenv -lws2_32 -lkernel32 -ladvapi32 -lbcrypt -lntdll -luserenv -lws2_32 -Wl,--allow-multiple-definition C:/ndi/mab/local64/lib/libaom.a C:/ndi/mab/local64/lib/libsharpyuv.a -lm -lntdll -luserenv -lws2_32 -lbcrypt C:/ndi/mab/local64/lib/libpng.a C:/ndi/mab/msys64/mingw64/lib/libz.a C:/ndi/mab/msys64/mingw64/lib/libjpeg.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." C:/ndi/mab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ndi/mab/msys64/mingw64/lib/../lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o): in function `main':
C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexewin.c:67:(.text.startup+0xbd): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
Same issue.
As a work around you has to disable libavif in the config file.
I did that and it worked :)
Same. There is no C:\M\B directory on my Windows partitions. I wonder why these paths are contained in the files CMakeDetermineCompilerABI_C.bin and CMakeDetermineCompilerABI_CXX.bin in build/libavif-git/build-32bit/CMakeFiles/3.27.7
Shall I create an issue in libavif repo?
I'm pretty sure it's caused by this commit and seemingly only affects building the avifinc/dec binaries. Adding -municode
to the link options for only those two binaries (not the lib) in the CMakeLists.txt file allows them to link (see the gcc docs for why), but I have no idea if the header file change in that commit will cause problems with other things too. I doubt it, since it appears to only be a header for the util binaries, but I've been too busy to look further into it.
For now, I'd suggest building without libavif or using a commit just prior to the above mentioned one if you're not familiar enough with cmake to do the above. I do have a potential patch that I'm still mulling over, but can't really spend time on it this week.
This has been fixed upstream, so it's probably okay to revert aa5f5e145992726bab144869f36cdbc6c090228e.