Real-ESRGAN-ncnn-vulkan icon indicating copy to clipboard operation
Real-ESRGAN-ncnn-vulkan copied to clipboard

fix MinGW compilation

Open hch12907 opened this issue 1 year ago • 1 comments

MinGW expects main() without the -municode option, but the code uses wmain(). This results in an error:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\realesrgan-ncnn-vulkan.dir\build.make:136: realesrgan-ncnn-vulkan.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:313: CMakeFiles/realesrgan-ncnn-vulkan.dir/all] Error 2
mingw32-make: *** [Makefile:148: all] Error 2

hch12907 avatar Feb 18 '23 19:02 hch12907

I assume there is a bug in MinGW swprintf(). The paths produced by swprintf() is incorrect unless I make those changes.

The error log (/r-x4 should be realesr-animevideov3-x4):

_wfopen C:\...\realesrgan-ncnn-vulkan-20220424-windows\models/r-x4.param failed
parse magic failed
_wfopen C:\...\realesrgan-ncnn-vulkan-20220424-windows\models/r-x4.bin failed
network graph not ready

hch12907 avatar Feb 18 '23 20:02 hch12907