installing gem puma on windows error - ruby-on-rails

My first step when trying to install the gem puma is to enter gem install puma --version 2.12.3 into my command prompt. Then this error appears. I don't know what to make of it.
C:\Users>gem install puma --version 2.12.3
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:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150809-8352-14jkju1.rb extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-cryptolib
--without-cryptolib
--with-libeay32lib
--without-libeay32lib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/puma-2
.12.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/puma-2.12.3/gem_make.out
Once I receive this , I follow these instructions https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows
And I receive this error:
C:\Users>gem install puma -- --with-opt- dir=c:\
openssl
ERROR: Loading command: install (LoadError)
127: The specified procedure could not be found. - C:/Ruby22-x64/lib/r
uby/2.2.0/x64-mingw32/openssl.so
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Side note: here is the mkmf.log
mkmf.log
Please Help! thanks!

I think I have found answer for your question. Here the link
You must download OpenSSL libraries. There are two types OpenSSL libraries, one for 32bit other for 64bit.
After you installed them run gem install puma -- --with-opt-dir=D:\openssl
--with-opt-dir=D:\openssl is folder direction where you have downloaded libs.
Some tutorials have links to openssl which is for 32bit computers. I realized this after several failures. Then I have downloaded 64 bit version.

Related

Unable to install Ruby 3.2.0 with Rbenv -- Missing Pysch gem

I'm currently trying to install Ruby 3.2.0 with Rbenv and I'm getting this error every time.
BUILD FAILED (Ubuntu 22.04 using ruby-build 20230202)
Inspect or clean up the working tree at /tmp/ruby-build.20230202161804.1244.1gO1Ch
Results logged to /tmp/ruby-build.20230202161804.1244.log
Last 10 log lines:
Fix the problems, then remove these directories and try again if you want.
make[1]: Leaving directory '/tmp/ruby-build.20230202161804.1244.1gO1Ch/ruby-3.2.0'
Generating RDoc documentation
/tmp/ruby-build.20230202161804.1244.1gO1Ch/ruby-3.2.0/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby. uh-oh! RDoc had a problem:
cannot load such file -- psych
run with --debug for full backtrace
make: *** [uncommon.mk:598: rdoc] Error 1
It seems this gem PSYCH is missing, but when I run
gem install psych
I get this other message.
Building native extensions. This could take a while...
ERROR: Error installing psych:
ERROR: Failed to build gem native extension.
current directory: /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/psych-5.0.2/ext/psych
/root/.rbenv/versions/3.1.3/bin/ruby -I /root/.rbenv/versions/3.1.3/lib/ruby/3.1.0 extconf.rb
checking for yaml.h... no
yaml.h not found
extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/root/.rbenv/versions/3.1.3/bin/$(RUBY_BASE_NAME)
--with-libyaml-source-dir
--without-libyaml-source-dir
--with-yaml-0.1-dir
--without-yaml-0.1-dir
--with-yaml-0.1-include
--without-yaml-0.1-include=${yaml-0.1-dir}/include
--with-yaml-0.1-lib
--without-yaml-0.1-lib=${yaml-0.1-dir}/lib
--with-yaml-0.1-config
--without-yaml-0.1-config
--with-pkg-config
--without-pkg-config
--with-libyaml-dir
--with-libyaml-include
--without-libyaml-include=${libyaml-dir}/include
--with-libyaml-lib
--without-libyaml-lib=${libyaml-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/psych-5.0.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/psych-5.0.2 for inspection.
Results logged to /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/psych-5.0.2/gem_make.out
Any help is super appreciated! Thanks

Configuring Fog to install in Ruby on Rails project

I'm learning ruby on rails and have had my project hosted on c9.io. In the process of migrating over to Amazon AWS Cloud9 I'm having to reinstall my gems to my project. I am getting a config error while trying to build gem native extensions.
I'm not actually sure how to configure this gem before I enter 'gem install fog' into the command line. I've tried searching on the Fog website but I can't find the info on their page.
The error is:
Building native extensions. This could take a while...
ERROR: Error installing fog:
ERROR: Failed to build gem native extension.
current directory: /home/ubuntu/.rvm/gems/ruby-2.3.4/gems/ovirt-engine-sdk-4.3.0/ext/ovirtsdk4c
/home/ubuntu/.rvm/rubies/ruby-2.3.4/bin/ruby -r ./siteconf20190515-17400-2yzzer.rb extconf.rb
checking for xml2-config... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/ubuntu/.rvm/rubies/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
--with-libxml2-config
--without-libxml2-config
--with-pkg-config
--without-pkg-config
extconf.rb:29:in `<main>': The "libxml2" package isn't available. (RuntimeError)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ubuntu/.rvm/gems/ruby-2.3.4/extensions/x86_64-linux/2.3.0/ovirt-engine-sdk-4.3.0/mkmf.log
extconf failed, exit code 1
The mkmf.log says:
find_executable: checking for xml2-config... -------------------- no
--------------------
"pkg-config --exists libxml2"
package configuration for libxml2 is not found
I just don't know how to translate this log message into my codebase so I can install fog and continue working on my app.
Instead of
gem 'fog'
Use
gem 'fog-aws'
In your gem file and it should work.
Try installing xml2 development package:
apt-get install libxml2-dev
This should work! (You might need to re-install Ruby after that.)

Nokogiri issues with Ruby on Rails

I'm trying to install nokogiri on my machine but I am receiving the following error:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.4/ext/nokogiri
/Users/username/.rbenv/versions/2.0.0-p481/bin/ruby -r ./siteconf20151127-29540-11ahx4h.rb extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/username/.rbenv/versions/2.0.0-p481/bin/ruby
--help
--clean
/Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:500:in `with_werror'
from /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:599:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:337:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-14/2.0.0-static/nokogiri-1.6.6.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.4 for inspection.
Results logged to /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-14/2.0.0-static/nokogiri-1.6.6.4/gem_make.out
I'm unsure how to go about fixing this as I do not have too much experience with setting up native extensions. Any help would be greatly appreciated. Let me know if more information needs to be presented.
This seems to be a common issue. You can check the following link
http://www.nokogiri.org/tutorials/installing_nokogiri.html
You will need to update the Rubygems to 2.4.5 or later and also check whether development tools is installed on you pc.
Or you can do the following if you are using bundle
gem update --system
gem install nokogiri -- --use-system-libraries
bundle config build.nokogiri --use-system-libraries
bundle install
I had to use version 1.6.7.rc4-x64-mingw32 (I'm on Windows). Added this line to my Gemfile:
gem 'nokogiri', '~> 1.6', '>= 1.6.7.rc4'
After combining many solutions from git issues and SO, this worked for me:
gem install nokogiri -v '1.6.7' -n /usr/local/bin -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
Although I did prepend sudo.

How to install ruby gem puma on windows

Welcome, gather around.
My first step when trying to install the gem puma is to enter gem install puma --version 2.12.3 into my command prompt. Then this error appears. I don't know what to make of it.
C:\Users>gem install puma --version 2.12.3
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:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150809-8352-14jkju1.rb extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-cryptolib
--without-cryptolib
--with-libeay32lib
--without-libeay32lib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/puma-2
.12.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/puma-2.12.3/gem_make.out
Please help, thank you!
You probably just need OpenSSL, but be warned that some gems just fail to work on Windows.
https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows

Rails, heroku installing puma on different disk gives error

I created free account on heroku. Now I am trying this getting started. My DevKit Ruby and openssl are placed inside my D:\ disk, not C:\, beacuse there is reason why I can't use C:\ disk. All files directories are placed in my path.
I have tried to install puma gem by this method, only defference is that disk name is D:\.
When I run gem install puma -- --with-opt-dir=D:\openssl it throws me an long error:
D:\>gem install puma -- --with-opt-dir=D:\openssl
Building native extensions with: '--with-opt-dir=D:\openssl'
This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
D:/Ruby21-x64/bin/ruby.exe -r ./siteconf20150406-5096-1vz5x1.rb extconf.rb -
-with-opt-dir=D:\openssl
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=D:/Ruby21-x64/bin/ruby
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-cryptolib
--without-cryptolib
--with-libeay32lib
--without-libeay32lib
extconf failed, exit code 1
Gem files will remain installed in D:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/puma-2
.11.1 for inspection.
Results logged to D:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0
/puma-2.11.1/gem_make.out
UPDATE
I have copied my libeay32.dll and ssleay32.dll inside of my D:\openssl\bin to D:\Ruby21-x64\bin. It said me that it already has these files, so I replaced them.
When I run gem install puma -- --with-opt-dir=D:\openssl it still throws me an error.
I have found solution.
Heroku site in this link gives OpenSSL ONLY FOR x86. If you have x64 you need to download it from there.
I hope in future Heroku will provide x64 ssl links in their tutorials.

Resources