32

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?

Sk93
  • 3,676
  • 3
  • 37
  • 67
Lewis-Eric
  • 321
  • 1
  • 3
  • 3
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Apple Stack Exchange](http://apple.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306). – jww Oct 19 '15 at 05:10
  • 2
    If you just want to install Thrift, why not `brew install thrift` ? – Shoham Jun 06 '17 at 07:42

6 Answers6

45

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'

Simon Baudry
  • 500
  • 5
  • 7
19

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

Franzi
  • 1,791
  • 23
  • 21
6

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.

Bart Joosten
  • 119
  • 1
  • 5
3

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.

jakeatwork
  • 487
  • 5
  • 17
  • Thank for your help,and I'm on EI Capitan,I do as Jeremy's answer,but I still can't work now, the error still out there.But I find I have no such directory like "/usr/local/opt/openssl",I only have directory like "/usr/local/openssl",but no matter which path I use, it still didn't work for me. Do you got some other solution? – Lewis-Eric Oct 20 '15 at 02:16
  • 4
    This solved my issue, thanks. Specifically: `gem install puma -- --with-opt-include=/usr/local/opt/openssl/include` – gdgr Nov 04 '15 at 11:52
  • @Lewis-Eric - i'd need to see more of the error log details to help. sorry. it looks like you have openssl installed, but for some reason the path isn't working. – jakeatwork Nov 20 '15 at 22:05
  • @Lewis-Eric hopefully this is resolved by now, but if not, `brew install openssl` should get the right version of OpenSSL for you. The specific comment that helped me was https://github.com/puma/puma/issues/718#issuecomment-139624081. Essentially, if you're using `bundle install`, it won't necessarily read the gem installed puma, so you need to set the global options for bundle/puma: `bundle config build.puma --with-opt-dir=/usr/local/opt/openssl` – jcasner Sep 25 '16 at 15:19
1

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'

0

I stole this hint from Rasmus@netflix.dynomite.build and it worked as a charm for me on an unrelated work problem:

brew install openssl@1.1
OPENSSL_ROOT=$(brew --cellar openssl)/$(brew list --versions openssl | tr ' ' '\n' | tail -1)
./configure "--with-openssl=$OPENSSL_ROOT"
ln -s $OPENSSL_ROOT/include/openssl openssl
LIBRARY_PATH=$LIBRARY_PATH:$OPENSSL_ROOT/lib make
LIMPIX64
  • 201
  • 1
  • 3
  • 12