haasn / libplacebo

Official mirror of libplacebo
http://libplacebo.org/
GNU Lesser General Public License v2.1
547 stars 69 forks source link

goto build error on MinGW #185

Closed DeadSix27 closed 1 year ago

DeadSix27 commented 1 year ago

Running into this build error and warning with MinGW and placebo (latest commit)

My temporary workaround: https://github.com/haasn/libplacebo/compare/master...DeadSix27:libplacebo:patch-1

My C skill isn't up to par though.


The error:

[55/82] x86_64-w64-mingw32-g++ -Isrc/libplacebo.a.p -Isrc -I../src -Isrc/include -I../src/include -Isrc/opengl/include -I../src/opengl/include -Isrc/shaders -Isrc/vulkan -Isrc/opengl/include/glad -I/xc2/work/toolchain/x86_64-w64-mingw32/x86_64-w64-mingw32/include -I/xc2/work/toolchain/x86_64-w64-mingw32/x86_64-w64-mingw32/include/spirv_cross -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++11 -O2 -g -D__CRT__NO_INLINE -pthread -isystem/xc2/work/sources/libplacebo/3rdparty/Vulkan-Headers/include -MD -MQ src/libplacebo.a.p/glsl_glslang.cc.obj -MF src/libplacebo.a.p/glsl_glslang.cc.obj.d -o src/libplacebo.a.p/glsl_glslang.cc.obj -c ../src/glsl/glslang.cc
FAILED: src/libplacebo.a.p/glsl_glslang.cc.obj
x86_64-w64-mingw32-g++ -Isrc/libplacebo.a.p -Isrc -I../src -Isrc/include -I../src/include -Isrc/opengl/include -I../src/opengl/include -Isrc/shaders -Isrc/vulkan -Isrc/opengl/include/glad -I/xc2/work/toolchain/x86_64-w64-mingw32/x86_64-w64-mingw32/include -I/xc2/work/toolchain/x86_64-w64-mingw32/x86_64-w64-mingw32/include/spirv_cross -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++11 -O2 -g -D__CRT__NO_INLINE -pthread -isystem/xc2/work/sources/libplacebo/3rdparty/Vulkan-Headers/include -MD -MQ src/libplacebo.a.p/glsl_glslang.cc.obj -MF src/libplacebo.a.p/glsl_glslang.cc.obj.d -o src/libplacebo.a.p/glsl_glslang.cc.obj -c ../src/glsl/glslang.cc
In file included from ../src/pl_thread.h:65,
                 from ../src/glsl/glslang.cc:24:
../src/pl_thread_win32.h: In function 'bool pl_thread_sleep(double)':
../src/pl_thread_win32.h:169:55: warning: narrowing conversion of '-(t * 1.0e+7)' from 'double' to 'LONGLONG' {aka 'long long int'} [-Wnarrowing]
  169 |     LARGE_INTEGER time = (LARGE_INTEGER){ .QuadPart = -(t * 1e7) };
      |                                                       ^~~~~~~~~~
../src/pl_thread_win32.h:178:1: error: jump to label 'end'
  178 | end:
      | ^~~
../src/pl_thread_win32.h:165:14: note:   from here
  165 |         goto end;
      |              ^~~
../src/pl_thread_win32.h:169:19: note:   crosses initialization of 'LARGE_INTEGER time'
  169 |     LARGE_INTEGER time = (LARGE_INTEGER){ .QuadPart = -(t * 1e7) };
      |                   ^~~~
haasn commented 1 year ago

cc @kasper93 I don't understand heads nor tails of this

kasper93 commented 1 year ago

Another thing that is not tested on CI? I'll send MR to fix this when I get time.

haasn commented 1 year ago

Oh, I understood now why it's failing, it's being included from a C++ file, and apparently jumping past an initialization is an error there even if the initialization is of a C struct??

kasper93 commented 1 year ago

Yes, exactly. And I was even thinking about it before, but forgot that we actually have one C++ file, which is disabled when shaderc is found. So not really something I tested. Too much faith in CI coverage :)