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

Need to specify --with-opt-dir on OSX 10.11 El Capitan. #718

Closed
idyll opened this issue Jun 23, 2015 · 17 comments
Closed

Need to specify --with-opt-dir on OSX 10.11 El Capitan. #718

idyll opened this issue Jun 23, 2015 · 17 comments

Comments

@idyll
Copy link

idyll commented Jun 23, 2015

Haven't had a change to dig into exactly what's going on but gem install fails on OSX 10.11 because it can't find some openssl headers.

When compiling mini_ssl.c I get a fatal error: 'openssl/bio.h' file not found.

As an aside the openssl situation is getting pretty crazy. Brew installs 1.0.2. Apple still installs 0.9.8. Of course Ruby is using 1.0.1.

If this is still an issue when 10.11 gets to beta 3 I will see if I can suggest a fix.

@jeremy
Copy link

jeremy commented Jun 24, 2015

10.11 removes /usr/include/openssl for good.

@ryanbrink
Copy link

Is there a simple workaround I can use for now?

Figured it out. It's not in the 10.11 SDK but is in the 10.10 SDK. Appending the --with-opt-include option seems to work. For example:

gem install puma -v '2.8.2' -- --with-opt-include="/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/"

@evanphx
Copy link
Member

evanphx commented Jul 14, 2015

Hrm, fun. I can make SSL support optional though I wonder if that will confuse folks.

@robertjpayne
Copy link

If you are installing home-brew openssl it's a lot easier:

`gem install puma -- --with-opt-include=/usr/local/opt/openssl/include``

@evanphx is there any way to specify a default opt-include path? Seems like you could state that openssl via homebrew is a requirement for installing it on OS X or the user must manually manage it.

@ghost
Copy link

ghost commented Aug 9, 2015

On El Capitan, @robertjpayne's answer works.

@evanphx evanphx closed this as completed Aug 15, 2015
@MxBird
Copy link

MxBird commented Aug 28, 2015

On El Capitan, @robertjpayne's answer works. many gem could install success in this way

@betoharres
Copy link

@robertjpayne worked to me as well ^^ thanks!

@jeremy
Copy link

jeremy commented Sep 11, 2015

To make this sticky for all your Gemfiles:

bundle config build.puma --with-opt-dir=/usr/local/opt/openssl

Confirm:

$ grep PUMA ~/.bundle/config 
BUNDLE_BUILD__PUMA: "--with-opt-dir=/usr/local/opt/openssl"

@jonnyarnold
Copy link

👍 for @jeremy's comment

@jeroenvisser101
Copy link

@jeremy, that's great!

chrisroos added a commit to chrisroos/dotfiles that referenced this issue Nov 6, 2015
@jomarquez
Copy link

👍 thank you @jeremy and @robertjpayne

@vkhang55
Copy link

vkhang55 commented Dec 1, 2015

👍 Jeremy

@kocodude
Copy link

kocodude commented Dec 7, 2015

awesome, thanks @jeremy and @robertjpayne

@chischaschos
Copy link

thank you @jeremy and @robertjpayne

@enderahmetyurt
Copy link

cheers @jeremy

@react-hunter
Copy link

react-hunter commented Jul 10, 2020

I tried this on my mac - 10.15.5 catalina. But, it still shows same error.
Can anyone help me?

Building native extensions with: '--with-opt-include=/usr/local/opt/openssl/include'
This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.

current directory: /Users/jinyong/.rvm/gems/ruby-2.6.5/gems/puma-4.3.3/ext/puma_http11

/Users/jinyong/.rvm/rubies/ruby-2.6.5/bin/ruby -I /Users/jinyong/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200710-2016-1t39osy.rb extconf.rb --with-opt-include=/usr/local/opt/openssl/include
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... yes
checking for DTLS_method() in openssl/ssl.h... yes
checking for TLS_server_method() in openssl/ssl.h... yes
checking for SSL_CTX_set_min_proto_version in openssl/ssl.h... yes
creating Makefile

current directory: /Users/jinyong/.rvm/gems/ruby-2.6.5/gems/puma-4.3.3/ext/puma_http11
make "DESTDIR=" clean

current directory: /Users/jinyong/.rvm/gems/ruby-2.6.5/gems/puma-4.3.3/ext/puma_http11
make "DESTDIR="
compiling http11_parser.c
ext/puma_http11/http11_parser.c:44:18: warning: unused variable 'puma_parser_en_main' [-Wunused-const-variable]
static const int puma_parser_en_main = 1;
^
1 warning generated.
compiling io_buffer.c
compiling mini_ssl.c
mini_ssl.c:145:7: warning: unused variable 'min' [-Wunused-variable]
int min, ssl_options;
^
mini_ssl.c:299:40: warning: function 'raise_error' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
void raise_error(SSL* ssl, int result) {
^
2 warnings generated.
compiling puma_http11.c
puma_http11.c:203:22: error: implicitly declaring library function 'isspace' with type 'int (int)' [-Werror,-Wimplicit-function-declaration]
while (vlen > 0 && isspace(value[vlen - 1])) vlen--;
^
puma_http11.c:203:22: note: include the header <ctype.h> or explicitly provide a declaration for 'isspace'
1 error generated.
make: *** [puma_http11.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/jinyong/.rvm/gems/ruby-2.6.5/gems/puma-4.3.3 for inspection.
Results logged to /Users/jinyong/.rvm/gems/ruby-2.6.5/extensions/x86_64-darwin-19/2.6.0/puma-4.3.3/gem_make.out

@dentarg
Copy link
Member

dentarg commented Jul 10, 2020

@whitehorse0324 it looks like you are running into issue #2304 (it is not solved for Puma 4.x series)

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