Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installing on MRI 2.3+ #6

Open
janko opened this issue Oct 18, 2017 · 6 comments
Open

Error installing on MRI 2.3+ #6

janko opened this issue Oct 18, 2017 · 6 comments

Comments

@janko
Copy link
Contributor

janko commented Oct 18, 2017

I get the following error when I try to gem install rabbitmq on MRI 2.3 or 2.4:

librabbitmq/amqp_openssl.c:39:10: fatal error: 'openssl/conf.h' file not found
#include <openssl/conf.h>
         ^~~~~~~~~~~~~~~~

Here is the full error log: https://gist.github.com/janko-m/2ae7441b0610f01baddbcdb00709c930

@janko
Copy link
Contributor Author

janko commented Oct 18, 2017

I only get that on my local Mac OS computer, it's not happening on Ubuntu.

@jemc
Copy link
Owner

jemc commented Oct 18, 2017

@janko-m Does openssl/conf.h exist anywhere on your machine (being a search path issue for this gem) or do openssl headers just need to be installed for you?

@janko
Copy link
Contributor Author

janko commented Oct 18, 2017

@jemc I do have OpenSSL installed and have the header file in /usr/local/Cellar/openssl/1.0.2l/include/openssl/conf.h (via Homebrew).

I saw that people had problems installing EventMachine, and that doing gem install eventmachine -- --with-cppflags=-I/usr/local/Cellar/openssl/1.0.2l/include would solve the issue, so I'm searching now the equivalent for C code (EventMachine has C++). I was able to normally install EventMachine, so I'm surprised that a gem with C extensions instead of C++ cannot find OpenSSL.

@janko
Copy link
Contributor Author

janko commented Oct 18, 2017

Ok, I found how do it with Puma in puma/puma#718 (comment), so I tried the same thing with rabbitmq:

$ gem install rabbitmq -- --with-opt-include=/usr/local/opt/openssl/include

But I still get the same error 😕. I checked that /usr/local/opt/openssl/include/openssl/conf.h exists.

@jemc
Copy link
Owner

jemc commented Oct 18, 2017

so I'm surprised that a gem with C extensions instead of C++ cannot find OpenSSL.

Well, the thing is that this gem doesn't actually have a C extension - it just uses the Rakefile hook to build the shared library, then links to that via FFI. That is, it uses a C library, but it doesn't build a C extension onto Ruby itself.

I think it might work to use the env vars recognized by C compilers.

What happens if you run env C_INCLUDE_PATH=/usr/local/opt/openssl/include gem install rabbitmq?

@janko
Copy link
Contributor Author

janko commented Oct 18, 2017

@jemc That works! Thank you for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants