alexcrichton / openssl-src-rs

Source code and logic to build OpenSSL from source
Apache License 2.0
68 stars 113 forks source link

When building without perl, unhelpful error message is printed #194

Open mcclure opened 1 year ago

mcclure commented 1 year ago

I filed this bug on rust-openssl and was told to refile here.

I ran cargo install wasm-pack on a Windows 10 machine, and got this very long, very oblique error message:

   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`

Apparently this is caused by wasm-pack indirectly including openssl-sys which indirectly uses openssl-src-rs. The problem was that Perl was not installed. Probably I should have realized this, but I failed to identify I was supposed to stitch the word "perl" in stdout with "program not found" inside a panic message a few lines later; I did not know what package or program was even missing until openssl-src-rs explained it to me.

Expected behavior: Whatever crate contains this unwrap() call should first check for Err(NotFound) and if it is hit, raise a simple "Perl not installed" error message. If other software is executed out of PATH, similar checks should probably be added there too.