rust-openssl / rust-openssl/rust-openssl

openssl-sys crate failed other crate's build, with unhelpful error

Open
#1,912 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
841
Avg merge
6h 51m
Merged PRs (30d)
4

Description

I have a Windows 10 machine with Rust 1.69.0 installed, target list x86_64-pc-windows-msvc and wasm32-unknown-unknown. I wanted to install "wasm-pack". So I ran cargo install wasm-pack in CMD.EXE.

It did the cargo thing fo ra while, then terminated with:

   Compiling form_urlencoded v1.1.0
   Compiling unicode-normalization v0.1.22
error: failed to run custom build command for `openssl-sys v0.9.87`

Caused by:
  process didn't exit successfully: `C:\Users\Andi\AppData\Local\Temp\cargo-install9nib5Z\release\build\openssl-sys-2807ec8e19e2c176\build-script-main` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  running "perl" "./Configure" "--prefix=C:\\Users\\Andi\\AppData\\Local\\Temp\\cargo-install9nib5Z\\release\\build\\openssl-sys-02242d1f2b328375\\out\\openssl-build\\install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "no-asm" "VC-WIN64A"

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: NotFound, message: "program not found" }', C:\Users\Andi\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-111.25.3+1.1.1t\src\lib.rs:504:39
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `wasm-pack v0.11.0`, intermediate artifacts can be found at `C:\Users\Andi\AppData\Local\Temp\cargo-install9nib5Z`

If I had to guess, I suspect this means I don't have OpenSSL dev libraries installed on my Windows machine. I see instructions in other issues in this github repo explaining how to point Cargo at OpenSSL. But that's not the problem. (It turns out I can just download binaries for wasm-pack anyway.) The problem is that this is a very, very bad error message. It doesn't explain to me what went wrong and it doesn't explain what I need to do or point me to a URL explaining what I need to do. It's just a raw panic. It seems like in other cases openssl-sys tries to catch failures such as this.

BTW I did a second build with RUST_BACKTRACE=1 and got

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: NotFound, message: "program not found" }', C:\Users\Andi\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-111.25.3+1.1.1t\src\lib.rs:504:39
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library\std\src\panicking.rs:579
     1: core::panicking::panic_fmt
               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library\core\src\panicking.rs:64
     2: core::result::unwrap_failed
               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library\core\src\result.rs:1750
     3: core::result::Result<T,E>::unwrap
     4: openssl_src::Build::build
     5: openssl_src::Build::build
     6: build_script_main::find_vendored::get_openssl
     7: build_script_main::env::{{closure}}
     8: build_script_main::find_openssl::{{closure}}
     9: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Windows build failure from the reported cargo install wasm-pack command, then inspect openssl-src/src/lib.rs around line 504 where the panic occurs. The change is complete when a missing program produces an actionable error instead of a raw unwrap panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.