乐趣区

关于macos:macOS-解决-No-package-openssl-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
ls -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 的相干包依赖门路注册到会话中,执行编译装置即可。

退出移动版