rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.39k stars 12.73k forks source link

rustc looking for "Windows resource compiler" at wrong location #108506

Closed liam-clink closed 1 year ago

liam-clink commented 1 year ago

I tried building lapce-ui with the MSVC toolchain

I expected to see this happen: build success

Instead, this happened: It appears that cargo/rustc is attempting to call the Windows resource compiler from a different location than it actually is, and rc.exe is in fact on the path. Why is rustc not using the rc.exe that is on PATH?

(exit code: 101)
  --- stdout
  package.metadata does not exist
  Selected RC path: 'bin\x64\rc.exe'

  --- stderr
  thread 'main' panicked at 'Failed to run the Windows resource compiler (rc.exe): Os { code: 3, kind: NotFound, message: "The system cannot find the path specified." }'

The actual location, which is on PATH, is C:\msvc\Windows Kits\10\bin\10.0.20348.0\x64

Meta

rustc --version --verbose:

rustc 1.67.1 (d5a82bbd2 2023-02-07)
binary: rustc
commit-hash: d5a82bbd26e1ad8b7401f6a718a9c57c96905483
commit-date: 2023-02-07
host: x86_64-pc-windows-msvc
release: 1.67.1
LLVM version: 15.0.6

I don't expect the backtrace to be helpful, as it's just a panic at being unable to find a binary.

Backtrace

``` stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:575 1: core::panicking::panic_fmt at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\panicking.rs:64 2: core::result::unwrap_failed at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\result.rs:1791 3: core::result::Result::expect 4: __ImageBase 5: core::ops::function::FnOnce::call_once ```

PatchMixolydic commented 1 year ago

This seems to be an issue in lapce-ui's build script. As far as I know, rustc doesn't invoke rc.exe on its own.

ChrisDenton commented 1 year ago

Yes, rc is not found by rust itself. It's found by the winres crate which is used by lapce-ui's build script.

liam-clink commented 1 year ago

@ChrisDenton How does the script determine where to look? Did you already fix this or should I work on a fix myself?

ChrisDenton commented 1 year ago

I do not know, only that it is not determined by rust. The issue trackers for laplace or winres would be a better place to ask.