puma: Compilation of Puma 2.13.4 on El Capitain GM with Command Line Tools 7.0 fails

Ruby 2.2.3 compiled with Clang Apple LLVM version 7.0.0 (clang-700.0.72) through ruby-build

Console output:

$ gem install puma -v '2.13.4'
Building native extensions.  This could take a while...
ERROR:  Error installing puma:
    ERROR: Failed to build gem native extension.

    /Users/deepj/.rubies/ruby-2.2.3/bin/ruby -r ./siteconf20150913-90782-12h8n45.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling http11_parser.c
compiling io_buffer.c
io_buffer.c:119:10: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
  return rb_str_new(b->top, b->cur - b->top);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/deepj/.rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/intern.h:796:20: note: expanded from macro 'rb_str_new'
        rb_str_new_static((str), (len)) : \
                          ^~~~~
/Users/deepj/.rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/intern.h:727:37: note: passing argument to parameter here
VALUE rb_str_new_static(const char *, long);
                                    ^
io_buffer.c:119:10: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
  return rb_str_new(b->top, b->cur - b->top);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/deepj/.rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/intern.h:797:13: note: expanded from macro 'rb_str_new'
        rb_str_new((str), (len));         \
                   ^~~~~
/Users/deepj/.rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/intern.h:706:29: note: passing argument to parameter here
VALUE rb_str_new(const char*, long);
                            ^
2 warnings generated.
compiling mini_ssl.c
In file included from mini_ssl.c:3:
/Users/deepj/.rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/backward/rubyio.h:2:2: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
#warning use "ruby/io.h" instead of "rubyio.h"
 ^
mini_ssl.c:4:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
         ^
1 warning and 1 error generated.
make: *** [mini_ssl.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/deepj/.gem/ruby/2.2.3/gems/puma-2.13.4 for inspection.
Results logged to /Users/deepj/.gem/ruby/2.2.3/extensions/x86_64-darwin-15/2.2.0-static/puma-2.13.4/gem_make.out
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin15.0.0

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 7
  • Comments: 26 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Instead of force linking openssl, this command worked for me using El Capitan (10.11) and openssl installed (but not linked) via Homebrew:

$ gem install puma -v 2.13.4 -- --with-opt-dir=/usr/local/opt/openssl

I would highly recommend against doing:

gem install X --with-opt-dir

This will only fix the problem for the current Ruby version your using, and the current Puma version. Any subsequent install will still fail. It’s much better to use @oshchygol’s advice of configuring Bundler to learn how to build Puma’s native extensions:

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

Again, assuming you’re using the openssl from Homebrew.

For the record your can find these build instructions in ~/.bundle/config or display them with bundle config.

assuming you’ve got openssl installed from homebrew (brew install openssl) bundle config build.puma --with-opt-dir=/usr/local/opt/openssl

One of solutions is the following

brew install openssl
brew link --force openssl

If I remember it correctly OpenSSL (headers only???) has been removed in favour of Apple’s own crypto library. Some solution how to fix this (as above) would be mentioned in README. I guess for some people this will be unpleasant surprise on El Captain.

+1 this worked for me on El Capitan gem install puma -v 2.13.4 -- --with-opt-dir=/usr/local/opt/openssl

For me worked only this (brew install openssl - without linking):

gem install puma -v '2.13.4' -- --with-opt-include=/usr/local/opt/openssl/include

And bundler config:

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

gem install puma -v ‘3.0.0’ – --with-opt-dir=/usr/local/opt/openssl bundle install 💪

You also need to care about in which directory is puma being installed. i.e. If you wat Puma to be installed in your application’s vendor/bundle directory you may have to run:

gem install puma -v 2.13.4 -i ./vendor/bundle -- --with-opt-dir=/usr/local/opt/openssl

Note: Puma version, vendor/bundle and openssl directories may be different in your case.

FYI – For users of macports, this can be solved similarly using the macports opt path:

gem install puma -- --with-opt-include=/opt/local

or with bundler config

bundle config build.puma --with-opt-include=/opt/local

+1. For older versions gem install puma -v '2.1X.X' -- --with-opt-dir=/usr/local/opt/openssl works like a charm.

Good news everyone! I’ve just released 2.14.0 which makes SSL optional. So on platforms without OpenSSL (like El Capitan) puma will build without issue but you won’t have SSL. Normally that’s not an issue on OS X, so there ya go!

  • gem install puma -v 2.13.4 – --with-opt-dir=/usr/local/opt/openssl
  • bundle config build.puma --with-opt-include=/usr/local/opt/openssl/include

worked on El Capitan. Thanks.