No package 'openssl' found / Package 'libssl', required by 'openssl', not found
No package 'openssl' found / Package 'libssl', required by 'openssl', not found
错误
- No package 'openssl' found
- Package 'libssl', required by 'openssl', not found
提示
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables OPENSSL_CFLAGS
and OPENSSL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
mac 下安装某些依赖 openssl 的依赖时,可能会遇到上面两个错误,首先确认是否已经安装了 openssl version / brew info openssl
,如果未安装,brew install openssl
。
1、补充 PKG_CONFIG_PATH 路径
# ~/.bash_profile
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
2、注册 openssl 到 pkgconfig 中
# 查看 openssl 是否在 pkgconfig 中
pkg-config --list-all | grep openssl
# 如果 pkgconfig 中没有 openssl 包 则手动建立 或者 尝试 brew unlink/link 重建
cd /usr/local/Cellar/openssl@1.1/1.1.1d/lib/pkgconfig
ln -s `pwd`/openssl.pc /usr/local/lib/pkgconfig
3、声明 openssl lib/include 的路径
export OPENSSL_LIBS="-L/usr/local/Cellar/openssl@1.1/1.1.1d/lib"
export OPENSSL_CFLAGS="-I/usr/local/Cellar/openssl@1.1/1.1.1d/include"
以上三步,就可以将 openssl 的相关包依赖路径注册到会话中,执行编译安装即可。