fatal error: 'openssl/bio.h' file not found

31,715

Solution 1

I'm on El Capitan 10.11.6 and i had the issue while installing manually the mongodb php extension.

I solved it following the indications of @user7059092 about the configure stage :

$./configure LDFLAGS='-L/usr/local/opt/openssl/lib' CPPFLAGS='-I/usr/local/opt/openssl/include'

Solution 2

I've the same problem while installing Thrift like others. In my case I solve following the next Jira:

https://jira.mongodb.org/browse/CDRIVER-941

Another approach is, after "brew install openssl", to do "brew link openssl --force", which installs headers to /usr/local/include/openssl.

$ brew install openssl 
$ brew link openssl --force

For some reason, Homebrew's own pkg-config knows that OpenSSL is homebrewed only once you run "link openssl --force":

$ pkg-config --variable=includedir openssl

/usr/local/Cellar/openssl/1.0.2d_1/include

Solution 3

I was also running into this problem when installing apache Thrift and here is how I solved it for my system setup.

My operating system is El Capitan (10.11.1) with all the latest updates installed and I used MacPorts to install openssl (version 1.0.2e 3 Dec 2015). This installed openssl in /opt/local. In any case, try to find bio.h (for my case was located at /opt/local/include/openssl/bio.h) and you can probably tell where openssl is installed for your setup. When you are in the libevent folder and run:

./configure --help

you will see that

--includedir=DIR        C header files [PREFIX/include]

Since PREFIX is /usr/local as per instructions, I just had to create a symlink in /usr/local/include.

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

Now make executes without errors.

Solution 4

Are you on El Capitan? That appeared to be my issue.

Jeremy's answer on this Puma issue worked for me:

https://github.com/puma/puma/issues/718

My issue was related to Puma gem specifically, but your issue might be similar if on El Capitan.

Solution 5

for installing libevent on Mac: http://macappstore.org/libevent/

takeaway for this site:

  1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
  2. brew install libevent

for the openssl error:

The cleanest method should be you tell the compiler to use MacOS's openssl by setting corresponding environment variables.

You can do that during the configure stage:

./configure CXXFLAGS='-I /usr/local/bin -L usr/local/include'

Share:
31,715
Admin
Author by

Admin

Updated on February 16, 2021

Comments

  • Admin
    Admin over 3 years

    I am trying to install Apache Thrift on my Mac, but am hitting an issue. I followed the installation steps on this page, but when I try to do the steps for installing libevent, I get the following error when running the make command:

    fatal error because of 'openssl/bio.h' file not found

    Screenshot of actual error

    I've checked the version of openSSL I'm using, and it's "0.9.8zg"

    Any advice on what I should do to fix this?