23

I'm trying to install the puma gem, but when I run

gem install puma

I get this error message:

Temporarily enhancing PATH to include DevKit
Building native extensions.  This could take a while...
ERROR:  Error installing puma:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile

make                                                
generating puma_http11-i386-mingw32.def                              
compiling http11_parser.c       
ext/http11/http11_parser.rl: In function 'puma_parser_execute':  
ext/http11/http11_parser.rl:111:3: warning: comparison between signed and unsigned integer   expressions    
compiling io_buffer.c   
io_buffer.c: In function 'buf_to_str':             
io_buffer.c:119:3: warning: pointer targets in passing argument 1 of 'rb_str_new'      differ in signedness             
c:/Ruby193/include/ruby-1.9.1/ruby/intern.h:653:7: note: expected 'const char *' but argument is of type 'uint8_t *'                    
compiling mini_ssl.c                                         
In file included from mini_ssl.c:3:0:                                        
c:/Ruby193/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"              
mini_ssl.c:4:25: fatal error: openssl/bio.h: No such file or directory               
compilation terminated.                     
make: *** [mini_ssl.o] Error 1             

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0/ext/puma_http11/gem_make.out

Adding gem 'puma' to my Gemfile and running bundle install isn't an option, because that just doesn't work with any gem and gives me an error message (which is a separate issue, one that I've circumvented with the other gems I've used by installing them via gem install).

Wayne Conrad
  • 103,207
  • 26
  • 155
  • 191
EJ107
  • 251
  • 1
  • 2
  • 4
  • 3
    It sounds like you might not have the openssl headers installed for your platform. Check out [puma issue GH#202](https://github.com/puma/puma/issues/202) for links to OpenSSL headers for Windows. – nbrew Nov 29 '13 at 22:52
  • try `gem install puma --source http://rubygems.org` – Gopal S Rathore Nov 30 '13 at 04:53
  • 1
    I ran `bundle update` before `bundle install` and that solved the issue. I'm not sure if that was the only thing that helped, as I manually downloaded openssl and `gem install puma -- --with-opt-dir=c:/RailsInstaller/openssl` `ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"` – Anis Abboud Feb 07 '15 at 22:36

4 Answers4

15

Came across very same issue.

sudo apt-get install libssl-dev

fixed it for me.

Vitali
  • 690
  • 9
  • 29
12

I ran bundle update before bundle install and that solved the issue for me.

I'm not sure if that was the only thing that helped, as I manually updated puma before that, using these steps:

  1. Checked which version of openssl Ruby is using by running ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"
  2. Downloaded the right openssl version from http://packages.openknapsack.org/openssl/openssl-1.0.0o-x86-windows.tar.lzma (got the link from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows and edited it based on the output of #1).
  3. Extracted openssl using http://www.7-zip.org to C:\RailsInstaller\openssl
  4. gem install puma -- --with-opt-dir=C:/RailsInstaller/openssl
Anis Abboud
  • 1,328
  • 2
  • 16
  • 23
  • I think it was the manual update. I followed those steps and it worked. Note that it's important to use forward slashes (`C:/RailsInstaller/openssl`) instead of backslashes (`C:\RailsInstaller\openssl`). – Eva Jul 19 '15 at 15:34
  • 1
    This worked for me, but I had to go hunting for a 64-bit version of openssl as I'm using 64-but Ruby etc. For reference, I found it here: https://bintray.com/artifact/download/oneclick/OpenKnapsack/x64/openssl-1.0.1l-x64-windows.tar.lzma – Taz Mar 02 '16 at 02:18
6

Figured out the solution to the puma bundle. Followed directions from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows

First you need to download:

  • DevKit compatible with your ruby version
  • OpenSSL Developer Package (contains header files and binaries)

And then:

  • Install DevKit, e.g. in c:\devkit
  • Unpack the OpenSSL Package, e.g. in c:\openssl (use 7Zip or PeaZip)
  • You need to copy the ddls from the bin directory (libeay32.dll and ssleay32.dll) to your ruby/bin directory.
  • Open a windows console
  • Initialize the DevKit build environment: c:\devkit\devkitvars.bat (except here, I used this in command prompt instead: ruby dk.rb init)

Now it’s possible to install the puma gem with the OpenSSL packages:

gem install puma -- --with-opt-dir=c:\openssl
evedovelli
  • 2,115
  • 28
  • 28
  • This solution worked for me. Just in case someone need detail: `gem install puma -v '2.9.1' -- --with-opt-dir=c:\openssl` `bundle install` – Seto May 21 '15 at 05:34
  • ruby/bin already had the 2 dlls on my system, I tried to overwrite them with the ones in openssl and ruby started to complain about openssl support. Reverted to the original files and everything worked fine, thank you! – cipak Sep 23 '15 at 09:14
3

I think you hit issue #430 https://github.com/puma/puma/issues/430

Re-installing Ruby might help you as well as it closed this issue on GitHub.

Nikolai Manek
  • 980
  • 6
  • 16