bundle/gemfile error installing knife-ec2 plugin - ruby

I''m not a ruby guy, trying to install the knife-ec2 plugin for Chef, following the steps here
All is fine until I do
$ bundle install --path vendor
which produces the error below:
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Installing i18n (0.6.9)
Installing multi_json (1.8.4)
Installing activesupport (3.2.16)
Installing addressable (2.3.5)
Installing builder (3.2.2)
Installing gyoku (1.1.1)
Installing mini_portile (0.5.2)
Installing nokogiri (1.6.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
/opt/chef/embedded/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp//ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp//ports/libxml2/2.8.0
/configure.log' to see what happened.
*** 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=/opt/chef/embedded/bin/ruby
/home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.5.2/lib/mini_
portile.rb:265:in `block in execute': Failed to complete configure task (Runtime
Error)
from /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.
5.2/lib/mini_portile.rb:257:in `chdir'
from /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.
5.2/lib/mini_portile.rb:257:in `execute'
from /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.
5.2/lib/mini_portile.rb:65:in `configure'
from /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.
5.2/lib/mini_portile.rb:108:in `cook'
from extconf.rb:101:in `block in <main>'
from extconf.rb:119:in `call'
from extconf.rb:119:in `block in <main>'
from extconf.rb:109:in `tap'
from extconf.rb:109:in `<main>'
Gem files will remain installed in /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.
1/gems/nokogiri-1.6.1 for inspection.
Results logged to /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/nokogiri-1
.6.1/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
Please let me know if posting additional files or console output would help.

You need to install libxml. The stacktrace shows you're on Ubuntu, so:
sudo apt-get install libxml2
See the Nokogiri readme for more information.

Related

How to pass build flags like `--with-ruby-include` to gem install?

(I know that my Ruby installation is a bit messed up, but:)
I'm trying to install a native gem and it gives me an error
ytg#yui:~> sudo /usr/bin/ruby.ruby2.3 /usr/bin/gem install ruby-debug-ide
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug-ide:
ERROR: Failed to build gem native extension.
current directory: /usr/lib64/ruby/gems/2.3.0/gems/ruby-debug-ide-0.6.0/ext
/usr/bin/ruby.ruby2.3 mkrf_conf.rb
Installing base gem
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Failed to build gem native extension.
current directory: /usr/lib64/ruby/gems/2.3.0/gems/debase-0.2.2.beta9/ext
/usr/bin/ruby.ruby2.3 -r ./siteconf20161213-12983-1q9o2d7.rb extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
*************************************************************
NOTE: If your headers were not found, try passing
--with-ruby-include=PATH_TO_HEADERS
*************************************************************
*** 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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME).ruby2.3
--with-ruby-dir
--without-ruby-dir
---with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib64
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/lib64/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/debase-0.2.2.beta9/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/lib64/ruby/gems/2.3.0/gems/debase-0.2.2.beta9 for inspection.
Results logged to /usr/lib64/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/debase-0.2.2.beta9/gem_make.out
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:92:in `run'
/usr/lib64/ruby/2.3.0/rubygems/ext/ext_conf_builder.rb:37:in `block in build'
/usr/lib64/ruby/2.3.0/tempfile.rb:295:in `open'
/usr/lib64/ruby/2.3.0/rubygems/ext/ext_conf_builder.rb:20:in `build'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:164:in `block (2 levels) in build_extension'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:163:in `chdir'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:163:in `block in build_extension'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:162:in `synchronize'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:162:in `build_extension'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:201:in `block in build_extensions'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:198:in `each'
/usr/lib64/ruby/2.3.0/rubygems/ext/builder.rb:198:in `build_extensions'
/usr/lib64/ruby/2.3.0/rubygems/installer.rb:742:in `build_extensions'
/usr/lib64/ruby/2.3.0/rubygems/installer.rb:291:in `install'
/usr/lib64/ruby/2.3.0/rubygems/request_set.rb:167:in `block in install'
/usr/lib64/ruby/2.3.0/rubygems/request_set.rb:151:in `each'
/usr/lib64/ruby/2.3.0/rubygems/request_set.rb:151:in `install'
/usr/lib64/ruby/2.3.0/rubygems/dependency_installer.rb:405:in `install'
mkrf_conf.rb:35:in `rescue in <main>'
mkrf_conf.rb:28:in `<main>'
rake failed, exit code 1
Gem files will remain installed in /usr/lib64/ruby/gems/2.3.0/gems/ruby-debug-ide-0.6.0 for inspection.
Results logged to /usr/lib64/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/ruby-debug-ide-0.6.0/gem_make.out
But then when I try to add the suggested argument, I get:
ytg#yui:~> sudo /usr/bin/ruby.ruby2.3 /usr/bin/gem install ruby-debug-ide --with-ruby-include="/usr/include/ruby-2.3.0/"
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-ruby-include=/usr/include/ruby-2.3.0/
/usr/lib64/ruby/2.3.0/rubygems/command.rb:378:in `handle_options'
/usr/lib64/ruby/2.3.0/rubygems/command.rb:299:in `invoke_with_build_args'
/usr/lib64/ruby/2.3.0/rubygems/command_manager.rb:169:in `process_args'
/usr/lib64/ruby/2.3.0/rubygems/command_manager.rb:139:in `run'
/usr/lib64/ruby/2.3.0/rubygems/gem_runner.rb:55:in `run'
/usr/bin/gem:21:in `<main>'
Is there a way to make gem install recognise those header files?
You have to separate the build flags from the options with --.
From the help page: (gem install --help)
Usage
gem install GEMNAME [GEMNAME ...] [options] -- --build-flags [options]
Later on:
Extension Install Failures
If an extension fails to compile during gem installation the gem specification is not written out, but the gem remains unpacked in the repository. You may need to specify the path to the library’s headers and libraries to continue. You can do this by adding a -- between RubyGems' options and the extension's build options:
$ gem install some_extension_gem
[build fails]
Gem files will remain installed in /path/to/gems/some_extension_gem-1.0 for inspection.
Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
$ gem install some_extension_gem -- --with-extension-lib=/path/to/lib
[build succeeds]

Bundle install not working on Windows

I am trying to deploy my Sinatra app on Heroku server and for that i need to follow few steps. One of them is "Bundle install" but I am facing below issue while executing "Bundle install" - [I am using windows machine]
I saw many posts on this site for this error but nothing worked for me.
Please suggest.
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable 2.3.8
Using daemons 1.2.2
Using data_objects 0.10.15
Using dm-core 1.2.1
Using dm-do-adapter 1.2.0
Using dm-migrations 1.2.0
Using do_postgres 0.10.15
Using dm-postgres-adapter 1.2.0
Using do_sqlite3 0.10.15
Using dm-sqlite-adapter 1.2.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/Ruby22/bin/ruby.exe -r ./siteconf20150515-3344-1qkfmhq.rb extconf.rb
checking for main() in -lssl... *** 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/bin/$(RUBY_BASE_NAME)
--with-openssl-config
--without-openssl-config
--with-pkg-config
--without-pkg-config
--with-ssl-dir
--without-ssl-dir
--with-ssl-include
--without-ssl-include=${ssl-dir}/include
--with-ssl-lib
--without-ssl-lib=${ssl-dir}/lib
--with-ssllib
--without-ssllib
C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generat
e an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:735:in `try_func'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:966:in `block in have_library'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpo
ne'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:961:in `have_library'
from extconf.rb:5:in `block in check_libs'
from extconf.rb:5:in `each'
from extconf.rb:5:in `all?'
from extconf.rb:5:in `check_libs'
from extconf.rb:39:in `manual_ssl_config'
from extconf.rb:64:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22/lib/ruby/gems/2.2.0/gems/eventmachi
ne-1.0.7 for inspection.
Results logged to C:/Ruby22/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/eve
ntmachine-1.0.7/gem_make.out
An error occurred while installing eventmachine (1.0.7), and Bundler cannot
continue.
Make sure that `gem install eventmachine -v '1.0.7'` succeeds before bundling.
I am able to solve this issue.
My development tool (Devkit) version was for 32 bit windows and ruby was 64 bit. So both were not compatible with each other.
I downloaded 32 bit version of both and followed the steps given on below links -
http://rubyonwindowsguides.github.io/book/ch02-05.html
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Archlinux

I'm trying to run jekyll locally on my laptop.
I followed the guide of Github to do that, https://help.github.com/articles/using-jekyll-with-pages
Unfortunaly I'm stuck when I have typed
$bundle install
I get the following error:
Fetching gem metadata from https://rubygems.org/.........Failed to load /etc/gemrc due to permissions problem.
Resolving dependencies...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for main() in -lc... *** 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=/usr/bin/ruby
--with-redcloth_scan-dir
--without-redcloth_scan-dir
--with-redcloth_scan-include
--without-redcloth_scan-include=${redcloth_scan-dir}/include
--with-redcloth_scan-lib
--without-redcloth_scan-lib=${redcloth_scan-dir}/lib
--with-clib
--without-clib
/usr/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
from /usr/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
from /usr/lib/ruby/2.1.0/mkmf.rb:742:in `try_func'
from /usr/lib/ruby/2.1.0/mkmf.rb:973:in `block in have_library'
from /usr/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /usr/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /usr/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /usr/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /usr/lib/ruby/2.1.0/mkmf.rb:968:in `have_library'
from extconf.rb:5:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /tmp/bundler20140903-2231-pkzqqj/RedCloth-4.2.9/gems /RedCloth-4.2.9 for inspection.
Results logged to /tmp/bundler20140903-2231-pkzqqj/RedCloth-4.2.9/extensions/x86_64-linux/2.1.0/RedCloth-4.2.9/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot
continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
I tryed to install ruby multiple times but it's not solving my problem. Do you have any hints?
I had this problem on MacOS and it was fixed by agreeing to the Xcode License. I had recently updated Xcode and it turns out that I needed to re-agree to the license in order to use the command line tools successfully.
Just run:
xcodebuild -license
This worked for me:
bundle config build.nokogiri --use-system-libraries
bundle install
brew install qt
then
gem install RedCloth -v '4.2.9'
then
bundle install

Error while Installing Nokogiri? mini_portile not available?

My Local Gem List
bundler (1.6.0)
childprocess (0.5.1)
ffi (1.9.3)
headless (1.0.1)
json (1.8.1)
mini_portile (0.5.3, 0.5.2)
minitest (5.3.1)
multi_json (1.9.0)
rake (10.2.2)
rdoc (4.1.1)
rubyzip (1.1.2)
selenium-webdriver (2.41.0, 2.40.0)
watir-webdriver (0.6.8)
websocket (1.0.7, 1.0.4)
I have also installed libxml2 and libxslt.
It says cannot load mini_portile gem but it shows in the local gem list.
Also I cannot sudo as I don't have the root privileges.
Error Message
Building native extensions. This could take a while...
ERROR: Error installing nokogiri-1.6.1.gem:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
*** 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=/usr/bin/ruby1.9.1
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mini_portile (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:92:in `<main>'
Gem files will remain installed in /home/jotsarup/.gem/gems/nokogiri-1.6.1 for inspection.
Results logged to /home/jotsarup/.gem/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out
Try to install nokogiri requirements first if u are using Ubuntu.
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri
other wise follow this link for Nokogiri Installation
Also try to set GEM_HOME to an absolute path like this:
GEM_HOME=$(pwd)/.gem gem1.9.3 install nokogiri
Using an relative path for GEM_HOME resulted in the mentioned error.

Installing a gem w/chef fails with Gem::Installer::ExtensionBuildError: chef_gem[fog]

I'm attempting to use the route53 cookbook but it continuously fails on the fog installation phase.
libxml2-dev and libxslt1-dev are already installed but the chef_gem "fog" phase fails:
Gem::Installer::ExtensionBuildError: chef_gem[fog] (route53::default line 42) had an error: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/chef/embedded/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp//ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp//ports/libxml2/2.8.0/configure.log' to see what happened.
*** 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=/opt/chef/embedded/bin/ruby
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.2/lib/mini_portile.rb:265:in `block in execute': Failed to complete configure task (RuntimeError)
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `chdir'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `execute'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.2/lib/mini_portile.rb:65:in `configure'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.2/lib/mini_portile.rb:108:in `cook'
from extconf.rb:101:in `block in <main>'
from extconf.rb:119:in `call'
from extconf.rb:119:in `block in <main>'
from extconf.rb:109:in `tap'
from extconf.rb:109:in `<main>'
Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out
Very similar to Installing a gem after native extension packages during chef execution but the circumstances are different. The installation recipe: https://github.com/hw-cookbooks/route53/blob/master/recipes/default.rb
Anyone have any suggestions as to how I can resolve this? Basically the fault is nokogiri won't install with ruby 1.9.3p484. /opt/chef/embedded/bin/gem install nokogiri fails as well.
You'll need to have the prerequisite packages installed on the machine. For instance, on Ubuntu you'll need the build-essential package and possibly some others installed in order for this to succeed.

Resources