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 的相關包依賴路徑注冊到會話中,執行編譯安裝即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM