shaderc-rs
shaderc-rs copied to clipboard
Fails to build in a directory that has a parent directory with spaces in the name
Initially reported here: https://www.reddit.com/r/rust/comments/9ye5s8/vulkano_fails_to_compile_after_implementing/
Doing cargo run --release in the directory /home/rubic/dir with space oh no/shaderc-rs
Results in this compile error.
97%] Building CXX object shaderc/glslc/CMakeFiles/glslc.dir/src/dependency_info.cc.o
[ 97%] Built target shaderc_shared
[ 98%] Linking CXX executable shaderc-online-compile
[ 98%] Built target shaderc-online-compile
[ 98%] Linking CXX static library libglslc.a
[ 98%] Built target glslc
--- stderr
usr/bin/ar: /home/rubic/dir: No such file or directory
make[2]: *** [shaderc/libshaderc/CMakeFiles/shaderc_combined_genfile.dir/build.make:69: shaderc/libshaderc/libshaderc_combined.a] Error 9
make[1]: *** [CMakeFiles/Makefile2:2984: shaderc/libshaderc/CMakeFiles/shaderc_combined_genfile.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:130: all] Error 2
thread 'main' panicked at '
command did not execute successfully, got: exit code: 2
build script failed, must exit now', /home/rubic/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.33/src/lib.rs:773:5
stack backtrace:
6: std::panicking::begin_panic_fmt
at libstd/panicking.rs:346
7: cmake::fail
8: cmake::run
9: cmake::Config::build
10: build_script_build::main
This is the important line: usr/bin/ar: /home/rubic/dir: No such file or directory
The path given to ar should be escaped.
Gah, whitespaces in paths, what a beautiful legacy we inherit from the past.
I'm using standard Path and the cmake-rs crate and thought they should have handled that, but it seems not.
Apparently it's quite difficult to come up with an elegant solution. I tried to escape the space, or quote it, all are not working.
I think we may need to fix cmake-rs for this.
The root cause of the problem appears to be: https://github.com/google/shaderc/issues/473
The fix is available starting in v2023.8. This repository needs to update their sources to get it.