OpenSSL not found on MacOS Sierra

。_饼干妹妹 提交于 2019-12-04 20:17:27

问题


I am trying to install a PHP MongoDB driver but the installation is failing because it cannot locate the OpenSSL.

/Users/username/mongo-php-driver/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c:24:10: fatal error: 'openssl/sha.h' file not found
#include <openssl/sha.h>
         ^
1 error generated.
make: *** [src/libmongoc/src/mongoc/mongoc-crypto-openssl.lo] Error 1

I read that this has something to do with the latest version of MacOS? Is there a way to do it, as I really need to install this driver.


回答1:


This is the only solution that worked for me.

cd /usr/local/include 
ln -s ../opt/openssl/include/openssl .

Source: https://www.anintegratedworld.com/mac-osx-fatal-error-opensslsha-h-file-not-found/




回答2:


You’ll need to install OpenSSL using homebrew, and tell homebrew to create necessary symlinks:

brew install openssl
brew link openssl --force

If you don’t already have homebrew installed, you can get it by running this:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

And before all that, if you haven’t already installed XCode and the XCode command-line tools:

xcode-select --install



回答3:


You can use environment variable C_INCLUDE_PATH to tell the compiler to include the path to openssl header files.

For example, if you just want to do it once:

sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include pecl install mongo


Reference: charles.lescampeurs.org



来源:https://stackoverflow.com/questions/42044221/openssl-not-found-on-macos-sierra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!