briansmith / ring

Safe, fast, small crypto using Rust
Other
3.64k stars 683 forks source link

warning: ring@0.17.8: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `C:\Program` installed? #2033

Closed hero-ku closed 2 months ago

hero-ku commented 2 months ago

Toolchain: x86_64-pc-windows-msvc

I'm getting an error, on Windows, about the GNU compiler not being supported, as well as C:\Program not being installed. Skimmed through some of the ring source code but I wouldn't know where to look. Is this some kind of Linux versus Windows path error? I can build for now by using WSL but my LSP is completely broken.

warning: ring@0.17.8: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `C:\Program` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
warning: ring@0.17.8: GNU compiler is not supported for this target
warning: ring@0.17.8: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `C:\Program` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
warning: ring@0.17.8: GNU compiler is not supported for this target

error: failed to run custom build command for `ring v0.17.8`

Caused by:
  process didn't exit successfully: `C:\Users\a_t_l\code\rust-bot\target\debug\build\ring-592e72dfd14aa8e7\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
  cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_8_
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-pc-windows-msvc")
  HOST = Some("x86_64-pc-windows-msvc")
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\Hostx64\\x64\\cl.exe")
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `C:\Program` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
  cargo:warning=GNU compiler is not supported for this target
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `C:\Program` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
  cargo:warning=GNU compiler is not supported for this target

  --- stderr

  error occurred: Failed to find tool. Is `Program` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
briansmith commented 2 months ago

The warning and errors are coming from the cc-rs crate.

 Is `Program` installed?

It looks to me like cc-rs is trying to parse the CC environment variable and for some reason the escaping and/or spaces are not being handled correctly. Try building without setting TARGET_CC or CC; then cc-rs should use the Windows registry to find MSRV.

hero-ku commented 2 months ago

That fixed it. I did take a look at cc-rs, but it probably would've helped if I knew more about build tools 😅.