1
No package 'openssl' found / Package 'libssl', required by 'openssl', not found

Mistake

- No package 'openssl' found

- Package 'libssl', required by 'openssl', not found

hint

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.

When installing some dependencies that depend on openssl under mac, you may encounter the above two errors. First, confirm whether openssl version / brew info openssl has been installed. If it is not installed, brew install openssl .

1. Supplement PKG_CONFIG_PATH path

# ~/.bash_profile
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

2. Register openssl to 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. Declare the path of 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"

With the above three steps, you can register openssl-related package dependency paths in the session, and execute the compilation and installation.


big_cat
1.7k 声望130 粉丝

规范至上