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

Target std=gnu++14 rather than std=c++14 on Windows systems #112

Open
visceralfield opened this issue Aug 27, 2019 · 5 comments
Open

Target std=gnu++14 rather than std=c++14 on Windows systems #112

visceralfield opened this issue Aug 27, 2019 · 5 comments

Comments

@visceralfield
Copy link

The spirv_cross build.rs sets the c++ compiler to use the c++14 standard. On POSIX systems this is fine, because those systems will simply implicitly include the POSIX standard as well. This is not the case on Windows while using GCC, however - it uses the strict c++14 standard. This does not include some key functions used by spirv_cross, namely strdup. Attempting to build a crate with spirv-cross as a dependency on x64 Windows 10 with GCC 9.10 results in the following laundry list of errors:

error: failed to run custom build command for `spirv_cross v0.14.2`
process didn't exit successfully: `C:\Users\sera4-1\Desktop\git\roguelike-rs-proto\target\debug\build\spirv_cross-ca6a20db42e8191e\build-script-build` (exit code: 1)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-pc-windows-msvc")
HOST = Some("x86_64-pc-windows-msvc")
CXX_x86_64-pc-windows-msvc = None
CXX_x86_64_pc_windows_msvc = None
HOST_CXX = None
CXX = Some("g++")
CXXFLAGS_x86_64-pc-windows-msvc = None
CXXFLAGS_x86_64_pc_windows_msvc = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
CXX_x86_64-pc-windows-msvc = None
CXX_x86_64_pc_windows_msvc = None
HOST_CXX = None
CXX = Some("g++")
CXXFLAGS_x86_64-pc-windows-msvc = None
CXXFLAGS_x86_64_pc_windows_msvc = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "g++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-DSPIRV_CROSS_WRAPPER_GLSL" "-DSPIRV_CROSS_WRAPPER_HLSL" "-std=c++14" "-FoC:\\Users\\sera4-1\\Desktop\\git\\roguelike-rs-proto\\target\\debug\\build\\spirv_cross-a26c25184055b81e\\out\\src\\wrapper.o" "-c" "src/wrapper.cpp"
cargo:warning=src/wrapper.cpp:2: warning: ignoring #pragma warning  [-Wunknown-pragmas]
cargo:warning=    2 | #pragma warning(disable : 4996 4101)
cargo:warning=      |
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_get_latest_exception_message(const char**)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:53:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=   53 |         INTERNAL_RESULT(*message = latest_exception_message;)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_hlsl_new(ScInternalCompilerHlsl**, const uint32_t*, size_t)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:59:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=   59 |         INTERNAL_RESULT(*compiler = new spirv_cross::CompilerHLSL(ir, size);)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_hlsl_set_options(const ScInternalCompilerHlsl*, const ScHlslCompilerOptions*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:64:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=   64 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_hlsl_set_root_constant_layout(const ScInternalCompilerHlsl*, const ScHlslRootConstant*, size_t)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:84:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=   84 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_glsl_new(ScInternalCompilerGlsl**, const uint32_t*, size_t)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:171:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  171 |         INTERNAL_RESULT(*compiler = new spirv_cross::CompilerGLSL(ir, size);)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_glsl_set_options(const ScInternalCompilerGlsl*, const ScGlslCompilerOptions*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:176:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  176 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_glsl_build_combined_image_samplers(const ScInternalCompilerBase*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:190:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  190 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_glsl_get_combined_image_samplers(const ScInternalCompilerBase*, const ScCombinedImageSampler**, size_t*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:198:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  198 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_decoration(const ScInternalCompilerBase*, uint32_t*, uint32_t, spv::Decoration)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:209:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  209 |         INTERNAL_RESULT(*result = ((spirv_cross::Compiler *)compiler)->get_decoration(id, decoration);)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_unset_decoration(const ScInternalCompilerBase*, uint32_t, spv::Decoration)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:214:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  214 |         INTERNAL_RESULT(((spirv_cross::Compiler *)compiler)->unset_decoration(id, decoration);)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_set_decoration(const ScInternalCompilerBase*, uint32_t, spv::Decoration, uint32_t)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:219:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  219 |         INTERNAL_RESULT(((spirv_cross::Compiler *)compiler)->set_decoration(id, decoration, argument);)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_set_name(const ScInternalCompilerBase*, uint32_t, const char*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:224:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  224 |         INTERNAL_RESULT(((spirv_cross::Compiler *)compiler)->set_name(id, std::string(name));)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_entry_points(const ScInternalCompilerBase*, ScEntryPoint**, size_t*)':
cargo:warning=src/wrapper.cpp:246:45: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=  246 |                     entry_points[i]->name = strdup(sc_entry_point.name.c_str());
cargo:warning=      |                                             ^~~~~~
cargo:warning=src/wrapper.cpp:28:17: note: in definition of macro 'INTERNAL_RESULT'
cargo:warning=   28 |                 block_to_attempt                          \
cargo:warning=      |                 ^~~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:229:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  229 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_cleansed_entry_point_name(const ScInternalCompilerBase*, const char*, spv::ExecutionModel, const char**)':
cargo:warning=src/wrapper.cpp:259:46: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=  259 |                 *compiled_entry_point_name = strdup(
cargo:warning=      |                                              ^~~~~~
cargo:warning=src/wrapper.cpp:28:17: note: in definition of macro 'INTERNAL_RESULT'
cargo:warning=   28 |                 block_to_attempt                          \
cargo:warning=      |                 ^~~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:257:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  257 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'void fill_resource_array(ScResourceArray*, const spirv_cross::SmallVector<spirv_cross::Resource>&)':
cargo:warning=src/wrapper.cpp:285:39: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=  285 |             resources->data[i].name = strdup(resource.name.c_str());
cargo:warning=      |                                       ^~~~~~
cargo:warning=      |                                       strcmp
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_shader_resources(const ScInternalCompilerBase*, ScShaderResources*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:291:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  291 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_specialization_constants(const ScInternalCompilerBase*, ScSpecializationConstant**, size_t*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:311:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  311 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_set_scalar_constant(const ScInternalCompilerBase*, uint32_t, uint32_t, uint32_t)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:330:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  330 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_type(const ScInternalCompilerBase*, uint32_t, const ScType**)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:339:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  339 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_member_name(const ScInternalCompilerBase*, uint32_t, uint32_t, const char**)':
cargo:warning=src/wrapper.cpp:383:25: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=  383 |                 *name = strdup(member_name.c_str());
cargo:warning=      |                         ^~~~~~
cargo:warning=src/wrapper.cpp:28:17: note: in definition of macro 'INTERNAL_RESULT'
cargo:warning=   28 |                 block_to_attempt                          \
cargo:warning=      |                 ^~~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:380:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  380 |         INTERNAL_RESULT(
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_member_decoration(const ScInternalCompilerBase*, uint32_t, uint32_t, spv::Decoration, uint32_t*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:389:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  389 |         INTERNAL_RESULT(*result = ((spirv_cross::Compiler *)compiler)->get_member_decoration(id, index, decoration);)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_set_member_decoration(const ScInternalCompilerBase*, uint32_t, uint32_t, spv::Decoration, uint32_t)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:394:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  394 |         INTERNAL_RESULT(((spirv_cross::Compiler *)compiler)->set_member_decoration(id, index, decoration, argument);)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_declared_struct_size(const ScInternalCompilerBase*, uint32_t, uint32_t*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:399:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  399 |         INTERNAL_RESULT(do {
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_declared_struct_member_size(const ScInternalCompilerBase*, uint32_t, uint32_t, uint32_t*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:407:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  407 |         INTERNAL_RESULT(do {
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_rename_interface_variable(const ScInternalCompilerBase*, const ScResource*, size_t, uint32_t, const char*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:415:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  415 |         INTERNAL_RESULT(do {
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_get_work_group_size_specialization_constants(const ScInternalCompilerBase*, ScSpecializationConstant**)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:437:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  437 |         INTERNAL_RESULT(do {
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_compile(const ScInternalCompilerBase*, const char**)':
cargo:warning=src/wrapper.cpp:457:35: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=  457 |         INTERNAL_RESULT(*shader = strdup(((spirv_cross::Compiler *)compiler)->compile().c_str());)
cargo:warning=      |                                   ^~~~~~
cargo:warning=src/wrapper.cpp:28:17: note: in definition of macro 'INTERNAL_RESULT'
cargo:warning=   28 |                 block_to_attempt                          \
cargo:warning=      |                 ^~~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:457:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  457 |         INTERNAL_RESULT(*shader = strdup(((spirv_cross::Compiler *)compiler)->compile().c_str());)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_compiler_delete(ScInternalCompilerBase*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:462:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  462 |         INTERNAL_RESULT(delete (spirv_cross::Compiler *)compiler;)
cargo:warning=      |         ^~~~~~~~~~~~~~~
cargo:warning=src/wrapper.cpp: In function 'ScInternalResult sc_internal_free_pointer(void*)':
cargo:warning=src/wrapper.cpp:34:40: error: 'strdup' was not declared in this scope; did you mean 'strcmp'?
cargo:warning=   34 |             latest_exception_message = strdup(ex.what()); \
cargo:warning=      |                                        ^~~~~~
cargo:warning=src/wrapper.cpp:467:9: note: in expansion of macro 'INTERNAL_RESULT'
cargo:warning=  467 |         INTERNAL_RESULT(free(pointer);)
cargo:warning=      |         ^~~~~~~~~~~~~~~
exit code: 1

--- stderr

error occurred: Command "g++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-DSPIRV_CROSS_WRAPPER_GLSL" "-DSPIRV_CROSS_WRAPPER_HLSL" "-std=c++14" "-FoC:\\Users\\sera4-1\\Desktop\\git\\roguelike-rs-proto\\target\\debug\\build\\spirv_cross-a26c25184055b81e\\out\\src\\wrapper.o" "-c" "src/wrapper.cpp" with args "g++" did not execute successfully (status code exit code: 1).

warning: build failed, waiting for other jobs to finish..

I do not have time at the moment to test, but I believe this can be fixed by telling the compiler to use std=gnu++11. This will include the relevant POSIX standard headers to enable strdup and friends to compile correctly. I will test this when I have time and respond back in this issue if I test a solution that works.

@grovesNL
Copy link
Owner

Thanks for reporting the issue!

We do run CI against both x86_64-pc-windows-gnu and x86_64-pc-windows-msvc on Windows (https://github.com/grovesNL/spirv_cross/blob/master/appveyor.yml#L8) so we should be sure any fix passes on both environments.

@visceralfield
Copy link
Author

Additionally - I can build this successfully with my mingw_w64 install at home, it's only with my MSYS2 based setup on another PC that I run into this issue. I believe mingw_w64 acts more POSIX-ey, but I'm not sure of the exact issue here.

@SonicZentropy
Copy link

Anybody have any more info on this? Running into it myself now

@ZoomRmc
Copy link

ZoomRmc commented Apr 12, 2020

Still have this bug under Cygwin.
Can confirm that it works with mingw_w64 (g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0)

@grovesNL
Copy link
Owner

If possible I'd recommend using MSVC for spirv_cross on Windows for now. I've hit some more issues with MSYS2/MinGW/Cygwin recently which sometimes need workarounds like rust-lang/rust#47048 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants