openssl を install しなおしたら、cargo install cargo-edit に成功した

2021/3/15
cargoRust
cargo install cargo-edit

したら、次のようなエラーが出た。

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

Caused by:
  process didn't exit successfully: `/var/folders/yk/dvp9tscj5f74jb4qpfsgdlrw0000gn/T/cargo-installNpfU6E/release/build/openssl-sys-01f907f1d5c8d463/build-script-main` (exit code: 101)

  --- 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.61

  openssl-sys crate build failed: no supported version of OpenSSL found.

  Ways to fix it:
  - Use the `vendored` feature of openssl-sys crate to build OpenSSL from source.
  - Use Homebrew to install the `openssl` package.

  ',/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.61/build/find_normal.rs:174: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-edit v0.7.0`, intermediate artifacts can be found at `/var/folders/yk/dvp9tscj5f74jb4qpfsgdlrw0000gn/T/cargo-installNpfU6E`

Caused by:
  build failed

ちなみに openSSL は入っている。

> openssl
OpenSSL>

もしかしたら古かったのかもと思い

brew install openssl

してから

cargo install cargo-edit

したら動いた。

もしかしたら、

brew install pkg-config

が効いたのかも知れない