google / shaderc-rs

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

Unable to build on Ubuntu 20.04 LTS - build wants "python" by name, but which one? #104

Closed John-Nagle closed 3 years ago

John-Nagle commented 3 years ago

The build script insists on finding "python", while Ubuntu 20.04 LTS offers only "python2" or "python3", to avoid confusion. Worked in 18.04 LTS, where "python" maps to "python 2.7".

Trouble is in "build.rs", in

    finder.must_have("cmake");
    finder.must_have("git");
    finder.must_have("python");

You want Python 2 or Python 3?

Backtrace of failed build follows.

~/projects/rend3/rend3$ cargo build
   Compiling thiserror-impl v1.0.23
   Compiling tracing-attributes v0.1.11
   Compiling futures-macro v0.3.12
   Compiling pin-project-internal v1.0.4
   Compiling pin-project-internal v0.4.27
   Compiling include_dir_impl v0.6.0
   Compiling spirv_cross v0.23.0
   Compiling shaderc-sys v0.6.3
The following warnings were emitted during compilation:

warning: Checking for system installed libraries.  Use --features = build-from-source to disable this behavior
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: `/home/john/projects/rend3/target/debug/build/shaderc-sys-d6277ce0e099dc4a/build-script-build` (exit code: 101)
  --- stdout
  cargo:warning=Checking for system installed libraries.  Use --features = build-from-source to disable this behavior
  cargo:warning=System installed library not found.  Falling back to build from source

  --- stderr
  thread 'main' panicked at '

  couldn't find required command: "python"

  ', /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-sys-0.6.3/build/cmd_finder.rs:50:13
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
     1: std::panicking::begin_panic_fmt
               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:437:5
     2: build_script_build::cmd_finder::CommandFinder::must_have::{{closure}}
               at ./build/cmd_finder.rs:50:13
     3: core::option::Option<T>::unwrap_or_else
               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/option.rs:427:21
     4: build_script_build::cmd_finder::CommandFinder::must_have
               at ./build/cmd_finder.rs:49:9
     5: build_script_build::main
               at ./build/build.rs:304:5
     6: core::ops::function::FnOnce::call_once
               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/ops/function.rs:227:5
  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
John-Nagle commented 3 years ago

Workaround: install Debian package "python-is-python3", a hack which does what you think it does.

gkelly commented 3 years ago

https://github.com/google/shaderc-rs/pull/105 resolves this issue. The underlying build finds python3 just fine, it's shaderc-rs's belief that it needs to be called "python" that stops this from progressing.

antiagainst commented 3 years ago

Yeah, it's just historical: the script exists before the full deprecation of Python2 but has never gotten updated. Thanks @gkelly for fixing it. I'll publish a new release.