Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goto build error on MinGW #185

Closed
DeadSix27 opened this issue Jul 31, 2023 · 4 comments
Closed

goto build error on MinGW #185

DeadSix27 opened this issue Jul 31, 2023 · 4 comments

Comments

@DeadSix27
Copy link

DeadSix27 commented Jul 31, 2023

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

My temporary workaround: 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
Copy link
Owner

haasn commented Jul 31, 2023

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

@kasper93
Copy link
Contributor

kasper93 commented Aug 1, 2023

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

@haasn
Copy link
Owner

haasn commented Aug 1, 2023

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
Copy link
Contributor

kasper93 commented Aug 1, 2023

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 :)

@haasn haasn closed this as completed in abf34ba Aug 1, 2023
passerbya pushed a commit to passerbya/libplacebo that referenced this issue Dec 13, 2023
Fixes compilation of glslang.cc due to more strict C++ prohibiting to
jump over variable initialization.

Also as a bonus check sleep time after converting to integer as it may
end up zero.

Fixes: haasn/libplacebo#185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants