AustinJ235 / basalt

A rust library that provides window creation, input handling, and most importantly a UI.
MIT License
149 stars 5 forks source link

Basalt fails to compile on Windows #11

Closed jrsmith17 closed 3 years ago

jrsmith17 commented 3 years ago

Hello, I've been evaluating Rust GUI libraries today - including yours. I noticed that the sample code you provided in the README fails to compile on Windows 10. I thought before moving on I would make the issue for your awareness. Here is my console output. Hope this helps!

`λ cargo run Compiling shaderc-sys v0.6.3 Compiling rental v0.5.5 The following warnings were emitted during compilation:

warning: System installed library not found. Falling back to build from source

error: failed to run custom build command for shaderc-sys v0.6.3

Caused by: process didn't exit successfully: D:\Projects\rust-gui-survey\basalt-test\target\debug\build\shaderc-sys-8bfa33387fdfb646\build-script-build (exit code: 101) --- stdout cargo:warning=System installed library not found. Falling back to build from source running: "cmake" "C:\Users\JR\.cargo\registry\src\github.com-1ecc6299db9ec823\shaderc-sys-0.6.3\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=D:\Projects\rust-gui-survey\basalt-test\target\debug\build\shaderc-sys-c4118a8fe839a887\out" "-DCMAKE_C_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" "-DCMAKE_BUILD_TYPE=Release" -- Building SPIRV-Header examples -- Installing SPIRV-Header -- Configuring incomplete, errors occurred! See also "D:/Projects/rust-gui-survey/basalt-test/target/debug/build/shaderc-sys-c4118a8fe839a887/out/build/CMakeFiles/CMakeOutput.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:/ProgramData/chocolatey/lib/cmake.portable/tools/cmake-3.13.2-win64-x64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find PythonInterp: Found unsuitable version "2.7.12", but required is at least "3" (found D:/Programs/Anaconda2/python.exe) Call Stack (most recent call first): C:/ProgramData/chocolatey/lib/cmake.portable/tools/cmake-3.13.2-win64-x64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:376 (_FPHSA_FAILURE_MESSAGE) C:/ProgramData/chocolatey/lib/cmake.portable/tools/cmake-3.13.2-win64-x64/share/cmake-3.13/Modules/FindPythonInterp.cmake:159 (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\JR.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.45\src\lib.rs:894:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: build failed`

AustinJ235 commented 3 years ago

Looking at this particular spot in the error message:

CMake Error at C:/ProgramData/chocolatey/lib/cmake.portable/tools/cmake-3.13.2-win64-x64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find PythonInterp: Found unsuitable version "2.7.12", but
required is at least "3" (found D:/Programs/Anaconda2/python.exe)

It appears that python3 isn't found on your system. Shaderc is pulled in via vulkano, so have a look at their setup section, https://github.com/vulkano-rs/vulkano#setup

mdegans commented 3 years ago

Same issue on my Windows install. It appears to be a problem in shaderc v0.6.3 that was fixed, but there are still issues detecting python if, for example, it's installed from the windows store. It does not appear the shaderc crate is very well tested on Windows leading to this sort of insanity:

Caused by:
  process didn't exit successfully: `C:\Users\user\Projects\basalt\target\debug\build\shaderc-sys-a59d646b0d50f3cd\build-script-build` (exit code: 101)
  --- stdout
  cargo:warning=System installed library not found.  Falling back to build from source

  --- stderr
  thread 'main' panicked at '

  couldn't find required command: "python"

  ', C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\shaderc-sys-0.6.3\build\cmd_finder.rs:50:13
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:493
     1: std::panicking::begin_panic_fmt
               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:435
     2: build_script_build::cmd_finder::{{impl}}::must_have::{{closure}}<str>
               at .\build\cmd_finder.rs:50
     3: core::option::Option<std::path::PathBuf>::unwrap_or_else<std::path::PathBuf,closure-0>
               at C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\option.rs:427
     4: build_script_build::cmd_finder::CommandFinder::must_have<str>
               at .\build\cmd_finder.rs:49
     6: core::ops::function::FnOnce::call_once<fn(),tuple<>>
               at C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:227
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
PS C:\Users\user\Projects\basalt> python
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

related issues: https://github.com/google/shaderc-rs/issues?q=windows+python

AustinJ235 commented 3 years ago

I have updated to vulkano 0.23 which uses the newer version of shaderc. I don't know if this issue is solved there.

AustinJ235 commented 3 years ago

I don't think this is an issue anymore.

space-alien commented 3 years ago

I just ran into this as well. All the build dependencies listed here are required, namely CMake, Git, Python, and probably Ninja. Might be worth mentioning this, along with aforementioned link, in the README?