rust openssl-src panic on install

I was trying to cargo install wasm-pack on an OpenSUSE Tumbleweed docker container and getting fucking stupid errors… turns out error handling is hard, let’s just assume everything’s going to work and .unwrap() all the things!

error: failed to run custom build command for `openssl-sys v0.9.65`

Caused by:

ared" "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" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
  Configuring OpenSSL version 1.1.1k (0x101010bfL) for linux-x86_64
  Using os-specific seed configuration
  Creating configdata.pm
  Creating Makefile

  **********************************************************************
  ***                                                                ***
  ***   OpenSSL has been successfully configured                     ***
  ***                                                                ***
  ***   If you encounter a problem while building, please open an    ***
  ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
  ***   and include the output from the following command:           ***
  ***                                                                ***
  ***       perl configdata.pm --dump                                ***
  ***                                                                ***
  ***   (If you are new to OpenSSL, you might want to consult the    ***
  ***   'Troubleshooting' section in the INSTALL file first)         ***
  ***                                                                ***
  **********************************************************************
  running "make" "depend"

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.15.0+1.1.1k/src/lib.rs:469:39
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
     1: core::panicking::panic_fmt
               at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
     2: core::result::unwrap_failed
               at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/result.rs:1355:5
     3: core::result::Result<T,E>::unwrap
     4: openssl_src::Build::run_command
     5: openssl_src::Build::build
     6: build_script_main::find_vendored::get_openssl
     7: build_script_main::find_openssl
     8: build_script_main::main
     9: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `wasm-pack v0.10.0`, intermediate artifacts can be found at `/tmp/cargo-install6Ag73g`

Turns out I needed to install make. 🤦🏼‍♂️

Slightly more explanation…

The error is from this line:

        let status = command.status().unwrap();

Where the status is actually a type that’ll have an error, and if the command you’re trying to call doesn’t exist… that’ll fail. I’ve opened a PR that hopefully will be merged to give a little more helpful output.



#rust #openssl #rant