Trying out WebAssembly, "cargo install cargo-generate" is causing errors

I'm trying out WebAssembly and trying to "cargo install cargo-generate" and it has the error message:

   Compiling backtrace v0.3.34
error: failed to run custom build command for `openssl-sys v0.9.48`

Caused by:
  process didn't exit successfully: `/var/folders/hm/mf3khvv53yn9ry4mx6385_7c0000gp/T/cargo-installuT2Odg/release/build/openssl-sys-84a052e8ab14b64e/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_LIB_DIR
X86_64_APPLE_DARWIN_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_INCLUDE_DIR
X86_64_APPLE_DARWIN_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_APPLE_DARWIN_OPENSSL_DIR
X86_64_APPLE_DARWIN_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
run pkg_config fail: "Failed to run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`: No such file or directory (os error 2)"

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-apple-darwin
$TARGET = x86_64-apple-darwin
openssl-sys = 0.9.48



It looks like you're compiling on macOS, where the system contains a version of
OpenSSL 0.9.8. This crate no longer supports OpenSSL 0.9.8.

As a consumer of this crate, you can fix this error by using Homebrew to
install the `openssl` package, or as a maintainer you can use the openssl-sys
0.7 crate for support with OpenSSL 0.9.8.

Unfortunately though the compile cannot continue, so aborting.

', /Users/ikevin/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.48/build/find_normal.rs:150:5
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 `cargo-generate v0.4.0`, intermediate artifacts can be found at `/var/folders/hm/mf3khvv53yn9ry4mx6385_7c0000gp/T/cargo-installuT2Odg`

Caused by:
  build failed

I'm using macOS 10.14.6, rustc and cargo are 1.36.0. How can I resolve this problem Thanks!

Reading the error, it seems that it could not find OpenSSL for the openssl_sys crate. Are you sure you've installed it correctly?

Yup, it went through. Solved. Thanks!

1 Like