jamienicol / glslopt-rs

Rust bindings to https://github.com/jamienicol/glsl-optimizer
4 stars 8 forks source link

Failed to build on windows with `1.43.1-i686-pc-windows-gnu` #3

Open SergeevPavel opened 4 years ago

SergeevPavel commented 4 years ago
[20:33:28]W:     [Step 3/4] error: failed to run custom build command for `glslopt v0.1.2`
[20:33:28]W:     [Step 3/4] 
[20:33:28]W:     [Step 3/4] Caused by:
[20:33:28]W:     [Step 3/4]   process didn't exit successfully: `C:\BuildAgent\work\7116a2615eef197f\fleet\noria\photon\target\release\build\glslopt-e62b1778ee4507c6\build-script-build` (exit code: 1)
[20:33:28]W:     [Step 3/4] --- stdout
[20:33:28]W:     [Step 3/4] TARGET = Some("i686-pc-windows-gnu")
[20:33:28]W:     [Step 3/4] OPT_LEVEL = Some("3")
[20:33:28]W:     [Step 3/4] HOST = Some("i686-pc-windows-gnu")
[20:33:28]W:     [Step 3/4] CC_i686-pc-windows-gnu = None
[20:33:28]W:     [Step 3/4] CC_i686_pc_windows_gnu = None
[20:33:28]W:     [Step 3/4] HOST_CC = None
[20:33:28]W:     [Step 3/4] CC = None
[20:33:28]W:     [Step 3/4] CFLAGS_i686-pc-windows-gnu = None
[20:33:28]W:     [Step 3/4] CFLAGS_i686_pc_windows_gnu = None
[20:33:28]W:     [Step 3/4] HOST_CFLAGS = None
[20:33:28]W:     [Step 3/4] CFLAGS = None
[20:33:28]W:     [Step 3/4] CRATE_CC_NO_DEFAULTS = None
[20:33:28]W:     [Step 3/4] DEBUG = Some("true")
[20:33:28]W:     [Step 3/4] CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
[20:33:28]W:     [Step 3/4] running: "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-I" "glsl-optimizer/include" "-I" "glsl-optimizer/src/mesa" "-I" "glsl-optimizer/src/mapi" "-I" "glsl-optimizer/src/compiler" "-I" "glsl-optimizer/src/compiler/glsl" "-I" "glsl-optimizer/src/gallium/auxiliary" "-I" "glsl-optimizer/src/gallium/include" "-I" "glsl-optimizer/src" "-I" "glsl-optimizer/src/util" "-D__STDC_FORMAT_MACROS" "-D_USE_MATH_DEFINES" "-o" "C:\\BuildAgent\\work\\7116a2615eef197f\\fleet\\noria\\photon\\target\\release\\build\\glslopt-59ab03d54daa25c9\\out\\glsl-optimizer/src/compiler/glsl/glcpp/glcpp-lex.o" "-c" "glsl-optimizer/src/compiler/glsl/glcpp/glcpp-lex.c"
[20:33:28]W:     [Step 3/4] cargo:warning=In file included from glsl-optimizer/src/compiler/glsl/glcpp/glcpp.h:34:0,
[20:33:28]W:     [Step 3/4] cargo:warning=                 from src/compiler/glsl/glcpp/glcpp-lex.l:29:
[20:33:28]W:     [Step 3/4] cargo:warning=glsl-optimizer/src/util/hash_table.h: In function 'hash_table_call_foreach':
[20:33:28]W:     [Step 3/4] cargo:warning=glsl-optimizer/src/util/hash_table.h:134:4: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[20:33:28]W:     [Step 3/4] cargo:warning=    for (struct hash_entry *entry = _mesa_hash_table_next_entry(ht, NULL);  \
[20:33:28]W:     [Step 3/4] cargo:warning=    ^
[20:33:28]W:     [Step 3/4] cargo:warning=glsl-optimizer/src/util/hash_table.h:145:4: note: in expansion of macro 'hash_table_foreach'
[20:33:28]W:     [Step 3/4] cargo:warning=    hash_table_foreach(ht, entry)
[20:33:28]W:     [Step 3/4] cargo:warning=    ^
[20:33:28]W:     [Step 3/4] cargo:warning=glsl-optimizer/src/util/hash_table.h:134:4: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
[20:33:28]W:     [Step 3/4] cargo:warning=    for (struct hash_entry *entry = _mesa_hash_table_next_entry(ht, NULL);  \
[20:33:28]W:     [Step 3/4] cargo:warning=    ^
[20:33:28]W:     [Step 3/4] cargo:warning=glsl-optimizer/src/util/hash_table.h:145:4: note: in expansion of macro 'hash_table_foreach'
[20:33:28]W:     [Step 3/4] cargo:warning=    hash_table_foreach(ht, entry)
[20:33:28]W:     [Step 3/4] cargo:warning=    ^
[20:33:28]W:     [Step 3/4] exit code: 1

Should we setup -std option for cc in build.rs?

jamienicol commented 4 years ago

Yes, setting the -std option sounds plausible. Is it expected that i686-pc-windows-gnu uses a different std by default than other platforms?

Do you have steps I can use to reproduce?

SergeevPavel commented 4 years ago

According to https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=vs-2019 MSVC use /std:c++14 so everything is fine. I invesitgate gcc and found that it use c11 as default and my problem was connected with too old compiler, I use https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/Standards.html#Standards. So steps to reproduce select some of gnu rust toolchain, and use gcc-4.9.3.