google / shaderc-rs

Rust bindings for the shaderc library.
https://docs.rs/shaderc
Apache License 2.0
259 stars 64 forks source link

Build Fails to Find Correct Python Version on Windows 10 #77

Closed Neightro closed 4 years ago

Neightro commented 4 years ago

I have just freshly installed Python versions 3.8.3 and 2.7.14 on Windows 10 using the 64-bit installers from the website. Python 3 is currently on my path, though Python 2 is not. Calling both python and py with the --version argument both return 3.8.3. As well, I have verified that Ninja and CMake can both be properly called from the command line.

When I attempt to build this crate, I get this error:

   Compiling shaderc-sys v0.6.2
error: failed to run custom build command for `shaderc-sys v0.6.2`

Caused by:
  process didn't exit successfully: `C:\Users\[username]\Rust Projects\vulkan-tutorial\target\debug\build\shaderc-sys-94432a1a0a3e5bc1\build-script-build` (exit code: 101)
--- stdout
cargo:warning=System installed library not found.  Falling back to build from source
running: "cmake" "C:\\Users\\[username]\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\shaderc-sys-0.6.2\\build" "-G" "Ninja" "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" "-DSPIRV_SKIP_EXECUTABLES=ON" "-DSPIRV_WERROR=OFF" "-DSHADERC_SKIP_TESTS=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_C_FLAGS= /nologo /EHsc /MD" "-DCMAKE_CXX_FLAGS= /nologo /EHsc /MD" "-DCMAKE_C_FLAGS_RELEASE= /nologo /EHsc /MD" "-DCMAKE_CXX_FLAGS_RELEASE= /nologo /EHsc /MD" "-DSHADERC_ENABLE_SHARED_CRT=ON" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\[username]\\Rust Projects\\vulkan-tutorial\\target\\debug\\build\\shaderc-sys-7a01563382570d55\\out" "-DCMAKE_C_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/HostX64/x64/cl.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/HostX64/x64/cl.exe" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/HostX64/x64/cl.exe" "-DCMAKE_BUILD_TYPE=Release"
-- Building SPIRV-Header examples
-- Installing SPIRV-Header
-- Configuring incomplete, errors occurred!
See also "C:/Users/[username]/Rust Projects/vulkan-tutorial/target/debug/build/shaderc-sys-7a01563382570d55/out/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/[username]/Rust Projects/vulkan-tutorial/target/debug/build/shaderc-sys-7a01563382570d55/out/build/CMakeFiles/CMakeError.log".

--- stderr
CMake Warning (dev) at CMakeLists.txt:8 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR
    CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PythonInterp: Found unsuitable version "2.7.13", but
  required is at least "3" (found C:/Python27/python.exe)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:376 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.15/Modules/FindPythonInterp.cmake:160 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  spirv-tools/CMakeLists.txt:181 (find_package)
  spirv-tools/CMakeLists.txt:191 (find_host_package)

thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', C:\Users\[username]\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.43\src\lib.rs:1104:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I decided to try renaming my Python 2 directory, as it seems that the script stops searching when it encounters Python 2. Doing so gets me this error instead. It appears that there is still a dependency on Python 2, so this output is perhaps not the most useful. I'll include it here regardless, in case it's of any interest.

   Compiling shaderc-sys v0.6.2
error: failed to run custom build command for `shaderc-sys v0.6.2`

Caused by:
  process didn't exit successfully: `C:\Users\[username]\Rust Projects\vulkan-tutorial\target\debug\build\shaderc-sys-94432a1a0a3e5bc1\build-script-build` (exit code: 101)
--- stdout
cargo:warning=System installed library not found.  Falling back to build from source
running: "cmake" "C:\\Users\\[username]\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\shaderc-sys-0.6.2\\build" "-G" "Ninja" "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" "-DSPIRV_SKIP_EXECUTABLES=ON" "-DSPIRV_WERROR=OFF" "-DSHADERC_SKIP_TESTS=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_C_FLAGS= /nologo /EHsc /MD" "-DCMAKE_CXX_FLAGS= /nologo /EHsc /MD" "-DCMAKE_C_FLAGS_RELEASE= /nologo /EHsc /MD" "-DCMAKE_CXX_FLAGS_RELEASE= /nologo /EHsc /MD" "-DSHADERC_ENABLE_SHARED_CRT=ON" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\[username]\\Rust Projects\\vulkan-tutorial\\target\\debug\\build\\shaderc-sys-7a01563382570d55\\out" "-DCMAKE_C_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/HostX64/x64/cl.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/HostX64/x64/cl.exe" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/HostX64/x64/cl.exe" "-DCMAKE_BUILD_TYPE=Release"
-- Building SPIRV-Header examples
-- Installing SPIRV-Header
-- Using Release VC++ CRT: MD
-- Google Mock was not found - tests based on that will not build
-- optimizer enabled
-- Shaderc: build type is "Release".
-- Configuring Shaderc to avoid building tests.
-- asciidoctor was not found - no documentation will be generated
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/[username]/Rust Projects/vulkan-tutorial/target/debug/build/shaderc-sys-7a01563382570d55/out/build
running: "cmake" "--build" "." "--target" "install" "--config" "Release" "--" "-j4"
[1/359] Generate extended instruction tables for opencl.debuginfo.100.
FAILED: spirv-tools/opencl.debuginfo.100.insts.inc
cmd.exe /C "cd /D "C:\Users\[username]\Rust Projects\vulkan-tutorial\target\debug\build\shaderc-sys-7a01563382570d55\out\build\spirv-tools\source" && C:\Python27\python.exe C:/Users/[username]/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/utils/generate_grammar_tables.py --extinst-vendor-grammar=C:/Users/[username]/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/source/extinst.opencl.debuginfo.100.grammar.json "--vendor-insts-output=C:/Users/[username]/Rust Projects/vulkan-tutorial/target/debug/build/shaderc-sys-7a01563382570d55/out/build/spirv-tools/opencl.debuginfo.100.insts.inc" --vendor-operand-kind-prefix=CLDEBUG100_"
The system cannot find the path specified.
[2/359] Generate extended instruction tables for spv-amd-shader-explicit-vertex-parameter.
FAILED: spirv-tools/spv-amd-shader-explicit-vertex-parameter.insts.inc
cmd.exe /C "cd /D "C:\Users\[username]\Rust Projects\vulkan-tutorial\target\debug\build\shaderc-sys-7a01563382570d55\out\build\spirv-tools\source" && C:\Python27\python.exe C:/Users/[username]/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/utils/generate_grammar_tables.py --extinst-vendor-grammar=C:/Users/[username]/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json "--vendor-insts-output=C:/Users/[username]/Rust Projects/vulkan-tutorial/target/debug/build/shaderc-sys-7a01563382570d55/out/build/spirv-tools/spv-amd-shader-explicit-vertex-parameter.insts.inc" --vendor-operand-kind-prefix="
The system cannot find the path specified.
[3/359] Generate extended instruction tables for spv-amd-gcn-shader.
FAILED: spirv-tools/spv-amd-gcn-shader.insts.inc
cmd.exe /C "cd /D "C:\Users\[username]\Rust Projects\vulkan-tutorial\target\debug\build\shaderc-sys-7a01563382570d55\out\build\spirv-tools\source" && C:\Python27\python.exe C:/Users/[username]/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/utils/generate_grammar_tables.py --extinst-vendor-grammar=C:/Users/[username]/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/source/extinst.spv-amd-gcn-shader.grammar.json "--vendor-insts-output=C:/Users/[username]/Rust Projects/vulkan-tutorial/target/debug/build/shaderc-sys-7a01563382570d55/out/build/spirv-tools/spv-amd-gcn-shader.insts.inc" --vendor-operand-kind-prefix="
The system cannot find the path specified.
[4/359] Generate extended instruction tables for debuginfo.
FAILED: spirv-tools/debuginfo.insts.inc
cmd.exe /C "cd /D "C:\Users\[username]\Rust Projects\vulkan-tutorial\target\debug\build\shaderc-sys-7a01563382570d55\out\build\spirv-tools\source" && C:\Python27\python.exe C:/Users/[username]/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/utils/generate_grammar_tables.py --extinst-vendor-grammar=C:/Users/[username]/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.2/build/spirv-tools/source/extinst.debuginfo.grammar.json "--vendor-insts-output=C:/Users/[username]/Rust Projects/vulkan-tutorial/target/debug/build/shaderc-sys-7a01563382570d55/out/build/spirv-tools/debuginfo.insts.inc" --vendor-operand-kind-prefix="
The system cannot find the path specified.
ninja: build stopped: subcommand failed.

--- stderr
CMake Warning (dev) at CMakeLists.txt:8 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR
    CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', C:\Users\[username]\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.43\src\lib.rs:1104:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It would seem that Python 2 is a dependency. Is there anything I can do to make sure that the build finds the versions it needs at the right time?

Neightro commented 4 years ago

Update: I discovered that deleting CMakeCache.txt from the build output directory fixes the problem. Sorry to trouble you! It seems like this is a known issue with CMake.