m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.49k stars 257 forks source link

libavif build failed #2635

Closed nille02 closed 2 months ago

nille02 commented 2 months ago

The Build fails with

15:56:40 ├ Running build...
Likely error (tail of the failed operation logfile):
D:/media-autobuild_suite/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/media-autobuild_suite/local64/lib/librav1e.a(rav1e.std-8984bea53711d8dc.std.822af3e2effa3d17-cgu.0.rcgu.o.rcgu.o):(.text+0x1eb93): undefined reference to `RtlNtStatusToDosError'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[1/2] Linking CXX executable avifenc.exe
FAILED: avifenc.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && D:\media-autobuild_suite\msys64\mingw64\bin\ccache.exe  g++ -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -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 CMakeFiles/avifenc.dir/apps/utf8.rc.obj -o avifenc.exe -Wl,--out-implib,libavifenc.dll.a -Wl,--major-image-version,0,--minor-image-version,0  libavif_apps.a  libavif_internal.a  D:/media-autobuild_suite/msys64/mingw64/lib/libyuv.a  -lm  D:/media-autobuild_suite/local64/lib/libdav1d.a  D:/media-autobuild_suite/local64/lib/librav1e.a  D:/media-autobuild_suite/local64/lib/libaom.a  D:/media-autobuild_suite/msys64/mingw64/lib/libpng.a  D:/media-autobuild_suite/msys64/mingw64/lib/libz.a  D:/media-autobuild_suite/msys64/mingw64/lib/libjpeg.a  -lmingwthrd  -lmingwthrd  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
D:/media-autobuild_suite/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/media-autobuild_suite/local64/lib/librav1e.a(rav1e.std-8984bea53711d8dc.std.822af3e2effa3d17-cgu.0.rcgu.o.rcgu.o):(.text+0x1eadc): undefined reference to `NtWriteFile'
D:/media-autobuild_suite/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/media-autobuild_suite/local64/lib/librav1e.a(rav1e.std-8984bea53711d8dc.std.822af3e2effa3d17-cgu.0.rcgu.o.rcgu.o):(.text+0x1eb93): undefined reference to `RtlNtStatusToDosError'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I searched a bit and a fix could be to use the gcc option "-lIphlpapi" to fix it but how?

logs.zip

Biswa96 commented 2 months ago

Adding -lntdll would be an workaround. I do not know where to add it.

nille02 commented 2 months ago

I did try to add the option with the custom_build_options but unfortunately the error is the same :(

Fishman0919 commented 2 months ago

Same from a fresh install.

19:26:28 Running git clone for libavif... 19:26:33 Running git update for libavif... 19:26:33 ┌ libavif git .............................. [Recently updated] 19:26:35 ├ Installing libyuv... done 19:26:38 ├ Running cmake... 19:26:42 ├ Running build... Likely error (tail of the failed operation logfile): ninja: build stopped: subcommand failed. [1/2] Linking CXX executable avifenc.exe FAILED: avifenc.exe C:\Windows\system32\cmd.exe /C "cd . && C:\MABS\msys64\mingw64\bin\ccache.exe g++ -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -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 CMakeFiles/avifenc.dir/apps/utf8.rc.obj -o avifenc.exe -Wl,--out-implib,libavifenc.dll.a -Wl,--major-image-version,0,--minor-image-version,0 libavif_apps.a libavif_internal.a C:/MABS/msys64/mingw64/lib/libyuv.a -lm C:/MABS/local64/lib/libdav1d.a C:/MABS/local64/lib/librav1e.a C:/MABS/local64/lib/libaom.a C:/MABS/local64/lib/libpng.a C:/MABS/msys64/mingw64/lib/libz.a C:/MABS/msys64/mingw64/lib/libjpeg.a -lmingwthrd -lmingwthrd -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." C:/MABS/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MABS/local64/lib/librav1e.a(rav1e.std-8984bea53711d8dc.std.822af3e2effa3d17-cgu.0.rcgu.o.rcgu.o): in function std::sys::pal::windows::c::NtWriteFile': /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library\std\src\sys\pal\windows/c.rs:309:(.text+0x1eadc): undefined reference toNtWriteFile' C:/MABS/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MABS/local64/lib/librav1e.a(rav1e.std-8984bea53711d8dc.std.822af3e2effa3d17-cgu.0.rcgu.o.rcgu.o): in function std::sys::pal::windows::handle::Handle::synchronous_write': /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library\std\src\sys\pal\windows/handle.rs:314:(.text+0x1eb93): undefined reference toRtlNtStatusToDosError' collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed. build failed. Check C:/MABS/build/libavif-git/build-64bit/ab-suite.build.log This is required for other packages, so this script will exit. 19:26:47 Creating diagnostics file...

Attach C:\MABS\build\logs.zip to the GitHub issue. Make sure the suite is up-to-date before reporting an issue. It might've been fixed already.

Try running the build again at a later time.

logs.zip

1480c1 commented 2 months ago

image it's supposed to have it from the pc file, but I guess something in their cmakelists did not pull it.

1480c1 commented 2 months ago

Seems it's their custom cmake module's fault.

https://github.com/AOMediaCodec/libavif/blob/main/cmake/Modules/Findrav1e.cmake

1480c1 commented 2 months ago

upstream issue https://github.com/AOMediaCodec/libavif/issues/2105

1480c1 commented 2 months ago

Should be closed with https://github.com/m-ab-s/media-autobuild_suite/commit/c30aef835cebb355584bba4e34a40c790dadcfb8

LigH-de commented 2 months ago

And it seems to be fixed upstream. I built it without updating the suite.