bkaradzic / bimg

Image library.
BSD 2-Clause "Simplified" License
333 stars 270 forks source link

mingw-gcc-release64 build fails (MinGW x86_64 8.1.0 posix seh) #25

Open Neonit opened 5 years ago

Neonit commented 5 years ago

I was trying to build bgfx with the mingw-gcc-release64 target, but it failed with the following error:

In file included from C:/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cmath:45,
                 from C:/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/math.h:36,
                 from ../../../../bimg/3rdparty/astc/astc_averages_and_directions.cpp:19:
C:/mingw64/x86_64-w64-mingw32/include/math.h: In function 'int __isnanl(long double)':
C:/mingw64/x86_64-w64-mingw32/include/math.h:573:65: error: lvalue required as left operand of assignment
     xx = (int) (ld.ldt->lh.low | (ld.ldt->lh.high & 0x7fffffffu)); /* explicit */
                                                                 ^
make[2]: *** [bimg_encode.make:713: ../../win64_mingw-gcc/obj/x64/Release/bimg_encode/bimg/3rdparty/astc/astc_averages_and_directions.o] Error 1
make[1]: *** [Makefile:33: bimg_encode] Error 2
make[1]: Leaving directory 'E:/repositories/bgfx/bgfx/.build/projects/gmake-mingw-gcc'
make: *** [makefile:125: mingw-gcc-release64] Error 2

Don't know, if this is a MinGW issue or not, but in a past issue a similar (?) error has been fixed in this repo.

Before trying to build the release target, it built mingw-gcc-debug64 without errors by the way.

Neonit commented 5 years ago

The above was tried with the default build files generated by running make without a target. make -n shows me that, by default, genie is run like ../bx/tools/bin/windows/genie --with-tools --with-combined-examples --with-shared-lib --gcc=mingw-gcc gmake.

I manually ran it like ../bx/tools/bin/windows/genie.exe --with-shared-lib --gcc=mingw-gcc gmake after deleting the .build directory and was able to make mingw-gcc-debug64 and mingw-gcc-release64 without errors. I think the problem described is within the tools or examples.

I feel this is not a good default or the documentation should mention it. Because with the default, a ~750 MB libspirv-optDebug.a and a ~500 MB shadercDebug.exe are also built. They are both not necessary for using the bgfx library and take a long time to build. By default, building with Visual Studio does not generate them, resulting in a much shorter build time.