Something’s wrong with my Pumas

Maybe it’s ironic that I decided to wear my Puma sneaks to work today, on the very same day I get into trouble installing the puma gem. Maybe it’s ironic that I tweeted something whacky about my Pumas just yesterday. Maybe it’s also ironic that Alanis Morissette decided to collaborate with me on this blog post. (Okay, that last point isn’t totally true.) Hi, I’m Cliff. You’re here because you don’t wear Puma sneakers. I’m here because I spend so much money on my family that I can’t afford to upgrade my kicks.

Just the other day I felt like I finally mastered RVM/Ruby/Rails. Today I hit another snag. Hold up though, this snag wasn’t as bad. You see, I think the Lord allows us to have trouble installing software like RVM in order to prepare us for the devil that comes out when you start installing other software like the puma gem. If I didn’t pay particular attention and read my error messages I would be scratching/snatching another bald spot into my scalp. The error I was getting was in the middle of a bundle install when it hit the puma gem. The last part of the error was:

3 warnings and 4 errors generated.
make: *** [mini_ssl.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/c.craig/.rvm/gems/ruby-2.3.3@tutorial/gems/puma-3.4.0 for inspection.

I could have figured it out from this text alone but I looked further up in the error messages just to be sure.

make "DESTDIR="
compiling http11_parser.c
ext/http11/http11_parser.rl:111:17: warning: comparison of integers of different
signs: 'long' and 'unsigned long' [-Wsign-compare]
  assert(pe - p == len - off && "pointers aren't same distance");
         ~~~~~~ ^  ~~~~~~~~~
/usr/include/assert.h:93:25: note: expanded from macro 'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e)
: (void)0)

This looked suspiciously like the error I got the other day. The problem seemed to be related to compile errors where the compiler was using the wrong version of openssl headers. I tried to use the same command line flag to see if the error would just disappear but that wouldn’t work.

gem install puma -C --with-openssl-dir=$HOME/.rvm/usr

Then I thought I would just upgrade to a different/newer version of Ruby instead of using the problematic 2.3.3 version that first introduced the problem. After upgrading to Ruby 2.5 I still saw the error. After a bit of Googling I found that I just needed a slightly different variant of the command line flag to point the gem installer to use the same openssl headers I installed for Ruby 2.3.3. The command to install the puma gem turned out to be:
gem install puma -- --with-opt-dir=/path/to/custom/openssl

I ran that and my errors went away! All in a day’s work! The lessons learned here are

  • Don’t panic when a given gem fails to install without errors.
  • Read your error messages carefully even/especially when you don’t understand them.
  • Don’t wear Puma sneakers to work.

Of all the bullet points the last one is most important.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s