-
Notifications
You must be signed in to change notification settings - Fork 629
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
The solution of brew link --force is not the best possible way #661
Comments
I absolutely agree, I think it is a very bad idea that people are doing |
@sodabrew Unfortunately not. I did try that. The only options to mkmf for pkgconfig are about which binary to use. Openssl is installed by homebrew keg-only (because os x has openssl already). The pkgconfig file is left inside the keg: $ gem install eventmachine -v "1.0.8"
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
# [...snip...]
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:116:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^
1 error generated.
make: *** [binder.o] Error 1
# [...snip...]
$ pkg-config openssl --cflags
# => empty
$ pkg-config openssl --debug
Scanning directory '/usr/local/lib/pkgconfig'
# [...snip...]
Scanning directory '/usr/lib/pkgconfig'
# [...snip...]
Will find package 'libssl' in file '/usr/lib/pkgconfig/libssl.pc'
Will find package 'openssl' in file '/usr/lib/pkgconfig/openssl.pc'
# [...snip...]
Scanning directory '/usr/local/Library/ENV/pkgconfig/10.11'
# [...snip...]
Reading 'openssl' from file '/usr/lib/pkgconfig/openssl.pc'
Parsing package file '/usr/lib/pkgconfig/openssl.pc'
$ brew --prefix
/usr/local
$ ls $(brew --prefix)/lib/pkgconfig
# (missing libcrypo.pc libssl.pc openssl.pc)
$ brew --prefix openssl
/usr/local/opt/openssl
$ ls $(brew --prefix openssl)/lib/pkgconfig
libcrypto.pc libssl.pc openssl.pc
$ PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" pkg-config openssl --cflags
-I/usr/local/Cellar/openssl/1.0.2d_1/include
$ PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" gem install eventmachine -v "1.0.8"
Fetching: eventmachine-1.0.8.gem (100%)
Building native extensions. This could take a while...
Successfully installed eventmachine-1.0.8
1 gem installed Unfortunately there is no command line argument equivalent, so we can't provide a |
Ah, so it's not just finding the right pkg-config binary. I didn't realize the openssl.pc file would also be in the keg. I'd like to make this auto-discovering, I'll try coming up with something that tries setting ENV['PKG_CONFIG_PATH'] as suggested. |
Indeed. Any pkg-config binary should actually be fine. It's the |
Just for other folks that find this from googling, I was able to install eventmachine on El Capitan using trunk Ruby and openssl from homebrew like this:
|
Doing a more careful clean install of HomeBrew on a clean install of El Capitan, I found that just doing a Another silly thing I found is that eventmachine's extconf.rb ends up providing options that both disable SSL when compiling, but link against I am half tempted to package in a subset of OpenSSL headers to cover the minimum public API that eventmachine needs. As a side effect, it would allow eventmachine Windows builds to use the bundled libssl.dll in the RubyInstaller packages. |
And like a minute later, I finally noticed that in the OP, @artyfarty suggests
|
It doesn't permanently solve the problem, but I added the path to my
which will ensure that on this machine at least, I don't have to remember how to do it 😄 |
Please try eventmachine-1.0.9, it should compile and install without error on El Capitan. Discuss issues on #668. |
I'm on El Capitan, trying to install eventmachine-1.0.9.1. It gives me the error of
After trying different solutions, and a little prayer, this one finally works:
|
I wonder if this is a bug / change in Ruby 2.3.0's handling of pkg_config? I'll look into it. Thanks for reporting! If we need to discuss further let's open a new issue. |
The solution presented in #643 is not the best one. Brew openssl is not symlinked by default for a reason, so forcing it into /usr/local is not the best idea.
It would be best for gem to actually try looking in brewed openssl folders by itself, but anyway, the safer way to build the gem is this:
gem install eventmachine -v '1.0.8' -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
Flags can be looked up in
brew info openssl
.The text was updated successfully, but these errors were encountered: