Skip to content

Instantly share code, notes, and snippets.

@esteedqueen
Last active August 31, 2018 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esteedqueen/315cf8d5d19f3d7e18dd25e15d888e04 to your computer and use it in GitHub Desktop.
Save esteedqueen/315cf8d5d19f3d7e18dd25e15d888e04 to your computer and use it in GitHub Desktop.
Puma gem install w/ ruby 2.0.0, rails 3.2 on MacOS 10.12

If you're installing puma version below 3.7 or 3.8, because puma requires openssl, you'll get the following error when you attempt to install the puma gem either directly or from a Gemfile:

Building native extensions.  This could take a while...
ERROR:  Error installing puma:
	ERROR: Failed to build gem native extension.

    current directory: /Users/esther/.rbenv/versions/2.3.0/gemsets/contagious/gems/puma-2.6.0/ext/puma_http11
/Users/esther/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20170830-2950-8i5exi.rb extconf.rb
creating Makefile

current directory: /Users/esther/.rbenv/versions/2.3.0/gemsets/contagious/gems/puma-2.6.0/ext/puma_http11
make "DESTDIR=" clean

current directory: /Users/esther/.rbenv/versions/2.3.0/gemsets/contagious/gems/puma-2.6.0/ext/puma_http11
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/esther/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/intern.h:800:20: note: expanded from macro 'rb_str_new'
        rb_str_new_static((str), (len)) : \
                          ^~~~~
/Users/esther/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/intern.h:729: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/esther/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/intern.h:801:13: note: expanded from macro 'rb_str_new'
        rb_str_new((str), (len));         \
                   ^~~~~
/Users/esther/.rbenv/versions/2.3.0/include/ruby-2.3.0/ruby/intern.h:708: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/esther/.rbenv/versions/2.3.0/include/ruby-2.3.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/esther/.rbenv/versions/2.3.0/gemsets/contagious/gems/puma-2.6.0 for inspection.
Results logged to /Users/esther/.rbenv/versions/2.3.0/gemsets/contagious/extensions/x86_64-darwin-16/2.3.0-static/puma-2.6.0/gem_make.out

To fix this:

gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib

OpenSSL 1.1 support was added on 3.7 or 3.8 puma/puma#1380

Ref: puma/puma#718

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment