ubuntu上cargo run报错error: failed to run custom build command for `openssl-sys v0.9.80`

这是因为使用reqwest的包,用到了openssl的库。
按照提示"Make sure you also have the development packages of openssl installed.
libssl-dev on Ubuntu or openssl-devel on Fedora.,

执行如下命令

1、 sudo apt install libssl-dev

再次执行cargo run 还是同样报错,再看提示,好像还缺一个包
“It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the pkg-config utility to find OpenSSL but unfortunately pkg-config
could not be found. If you have OpenSSL installed you can likely fix this by
installing pkg-config.“

2、 sudo apt install pkg-config

安装完成后,再执行cargo run 编译通过了。

posted @ 2022-12-30 21:16  千年寒冰火  阅读(1228)  评论(0编辑  收藏  举报