cmake-rs icon indicating copy to clipboard operation
cmake-rs copied to clipboard

Windows 2022: couldn't determine visual studio generator

Open nibanks opened this issue 3 years ago • 5 comments

We use the cmake crate in our CI for building msquic. We just tried updating the Azure Pipeline to use Windows Server 2022 instead of 2019 to build it and the CI failed.

We are getting the following error (from here):

  --- stderr
  thread 'main' panicked at '

  couldn't determine visual studio generator
  if VisualStudio is installed, however, consider running the appropriate vcvars script before building this crate

We have no problem with any non-Rust cmake builds, so I suspect this is something specific to the the cmake crate. Do you know of any work around for this? For the time being we can continue to use 2019, but eventually that will be deprecated. Thanks!

nibanks avatar Jan 25 '22 17:01 nibanks

Looks like the error is coming from the cc crate: https://github.com/alexcrichton/cc-rs/blob/030baede12f079793cc50d6f90b677b889c49fcd/src/windows_registry.rs#L150

aloucks avatar Jan 26 '22 22:01 aloucks

Thanks, this helped me to fix the same issue by settings runs-on: windows-2019 for the time being.

Byron avatar Feb 13 '22 13:02 Byron

@aloucks Looks to me like it's not cc but cmake: https://github.com/alexcrichton/cmake-rs/blob/7793895d88acc45d29fac7c711ddaef11c897ea9/src/lib.rs#L610-L621

I assume Vs17 must be added.

@nibanks Is your target i686?

stefangalowicz avatar Feb 16 '22 16:02 stefangalowicz

@nibanks Is your target i686?

We're just running on a windows-2022 agent in Azure Pipelines. I assume it's x64. cc @thhous-msft

nibanks avatar Feb 16 '22 17:02 nibanks

Hi, for anyone interested in a temporary solution - just add this patch to your root Cargo.toml, VS2022 support is already merged, but new cc version is not yet released:

[patch.crates-io]
cc = { git = "https://github.com/alexcrichton/cc-rs" }

pacmancoder avatar Feb 16 '22 18:02 pacmancoder