WSL 环境编译依赖 OpenSSL 的包遇到报错。第一个报错通过 sudo apt-get install pkg-config
解决了,后面依然提示找不到 openssl,但执行 openssl version
可以看到系统里已经安装了。
之后执行 sudo apt-get install libssl-dev
和 sudo apt-get update
遇到很多 404 Not Found 错误。
猜想是不是版本太老了,都打开 Microsoft Store 准备重装 WSL 了,在描述里看到
To keep your Debian environment up-to-date please use the following commands:
$ sudo apt update $ sudo apt dist-upgrade
依次执行:
sudo apt update
sudo apt-get update
sudo apt-get install libssl-dev
问题解决。
其他问题的解决可以看这里:在 WSL 中安装 Rust 交叉编译环境和报错解决
初始报错信息:
run pkg_config fail: `"pkg-config" "--libs" "--cflags" "openssl"` did not exit successfully: exit status: 1
error: could not find system library 'openssl' required by the 'openssl-sys' crate
--- stderr
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'openssl' found
--- 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-unknown-linux-gnu
$TARGET = x86_64-unknown-linux-gnu
openssl-sys = 0.9.84