Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unwrap call in windows_msvc_system results in unclear error message. #82

Open
cgranade opened this issue Jan 20, 2022 · 0 comments
Open
Labels

Comments

@cgranade
Copy link

When attempting to compile a crate that depends on openblas-src with static and system features enabled and when using a Windows host, a confusing error message is raised when necessary vcpkg packages are not yet installed:

➜ cargo build
   Compiling openblas-src v0.10.4
error: failed to run custom build command for `openblas-src v0.10.4`

Caused by:
  process didn't exit successfully: `<path-to-project>\target\debug\build\openblas-src-ee3a2010492c76c2\build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: VcpkgInstallation("could not read status file updates dir: The system cannot find the path specified. (os error 3)")', C:\Users\<username>\.cargo\registry\src\github.com-1ecc6299db9ec823\openblas-src-0.10.4\build.rs:40:37
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The root cause seems to be an unwrap call at build.rs:40:

/// Use vcpkg for msvc "system" feature
fn windows_msvc_system() {
    if feature_enabled("static") {
        env::set_var("CARGO_CFG_TARGET_FEATURE", "crt-static");
    } else {
        env::set_var("VCPKGRS_DYNAMIC", "1");
    }
    #[cfg(target_env = "msvc")]
    vcpkg::find_package("openblas").unwrap();  // ← this unwrap fails when openblas pkg is missing
    if !cfg!(target_env = "msvc") {
        unreachable!();
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants