google / shaderc-rs

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

Undocumented dependency on Python2 #71

Closed nbraud closed 2 years ago

nbraud commented 4 years ago

The build instructions only mentions Python 3.x, yet attempting to build without Python 2.x installed results in a build failure:

To build your own libshaderc for the shaderc-sys crate, the following tools must be installed and available on PATH:

  • CMake
  • Git
  • Python (only works with both Python 3.x, on windows the executable must be named python.exe)
  • a C++11 compiler

Given that Python2 reached its end-of-life on January 1st, and that many distributions (including Debian) are removing it from their future releases, I would strongly recommend getting rid of the dependency.

nbraud commented 4 years ago

PS: Here is the build log


  Compiling shaderc-sys v0.6.1 (.../shaderc-rs/shaderc-sys)
error: failed to run custom build command for `shaderc-sys v0.6.1 (.../shaderc-rs/shaderc-sys)`

Caused by:
  process didn't exit successfully: `.../shaderc-rs/target/debug/build/shaderc-sys-260db23ca7914fa3/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"

', shaderc-sys/build/cmd_finder.rs:50:13
johanster commented 4 years ago

I don't think this message is due to Python versions. What OS are you working on, and how did you install Python?

I ran into the same error message on Windows 10 and using the Windows Store version of Python. This doesn't seem to work. My theory is that the build script looks for python.exe in AppData\Local\Microsoft\WindowsApps and there is only a link there, not a regular file.

Installing the 3.8.1 "proper release" from the Python site worked for me.

nbraud commented 4 years ago

@johanster This is Debian 11 (bullseye/testing) and my python installation is straight from the Debian repos:

$ apt-cache policy python3 
python3:
  Installed: 3.7.5-3
  Candidate: 3.7.5-3
  Version table:
     3.8.0-3 1
          1 http://localhost:3142/debian experimental/main amd64 Packages
 *** 3.7.5-3 990
        990 http://localhost:3142/debian bullseye/main amd64 Packages
        500 http://localhost:3142/debian sid/main amd64 Packages
        100 /var/lib/dpkg/status

The issue seems to be that the python binary is invoked, even though it should be python3 on most, if not all, Linux distributions.

antiagainst commented 4 years ago

I think it makes sense to search and invoke python3 explicitly. But I'm not so familiar with Windows; it would be nice to get @rukai's opinion here given that he did the windows setup steps initially.

Craig-Macomber commented 4 years ago

Same issue as nbraud here, though I'm on Ubuntu 20.04. Installing python-is-python3 resolve the issue for me.

LoganDark commented 2 years ago

I can't use this library at all because of the Python requirement -- really wish people would eliminate their dependencies on fluff like that.

antiagainst commented 2 years ago

https://github.com/google/shaderc-rs/commit/21bb994197b536acabd1ddfd3ca82f27d1150645 was landed a while ago to try to search Python3 first. Not sure that's sufficient to address the issue. If not, please open new issues.