gem install knife-ec2 error - amazon-ec2

I have installed a chef-server on a centos machine and I have also set up a workstation on another centos machine.
I have also set up the knife. Now I want to install knife-ec2 plug-in.
I am trying to install the knife plugin but getting the following error :
[root#ip-server-ip- chef-repo]# /opt/chef/embedded/bin/gem install knife-ec2
Building native extensions. This could take a while...
Building nokogiri using packaged libraries.
ERROR: Error installing knife-ec2:
ERROR: Failed to build gem native extension.
/opt/chef/embedded/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
checking for iconv.h... *** 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
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:103:in `have_iconv?'
from extconf.rb:148:in `block (2 levels) in iconv_prefix'
from extconf.rb:90:in `preserving_globals'
from extconf.rb:143:in `block in iconv_prefix'
from extconf.rb:116:in `block in each_iconv_idir'
from extconf.rb:113:in `each'
from extconf.rb:113:in `each_iconv_idir'
from extconf.rb:137:in `iconv_prefix'
from extconf.rb:424:in `block in <main>'
from extconf.rb:161:in `block in process_recipe'
from extconf.rb:154:in `tap'
from extconf.rb:154:in `process_recipe'
from extconf.rb:419:in `<main>'
Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.2.1/ext/nokogiri/gem_make.out
How to resolve this error.
Any lead is highly appreciated.
Thanks

The knife-ec2 gem dependes on a gem called nokogiri. The nokogiri gem is a binary and needs to be compiled when it is installed. If you scroll down the error message you will see the following line:
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
It's just telling you to install gcc and make on your workstation. In centos you can do this by running:
$ sudo yum groupinstall development-tools
This will get you everything you need to start compiling gem binaries.
If you are just starting out with chef I would actually recommend the chef development kit, Chef-DK. It gives you all the tools you need to get started along with testing tools and helper commands to generate cookbooks.
Good Luck!

Try installing the following packages . I faced a similar error while installing . My problem solved . It might help you .
sudo apt-get install build-essential
sudo apt-get install g++ build-essential
sudo apt-get install rubygems ruby1.9.1
And then install knife ec-2 pluggin
$ /opt/chef/embedded/bin/gem install knife-ec2

Related

Getting error installing sass through gem on mac os catalina

I am facing issue installing sass through gem using command sudo gem install sass, unfortunately I have to install it through gem. I installed gem in my system through npm install -g gem. My system OS in Mac Os catalina. Dont know how to fix it.
Below is the error message I am getting while installing it through gem.
sudo gem install sass
Building native extensions. This could take a while...
ERROR: Error installing sass:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20200820-26013-1wnnsu3.rb extconf.rb
checking for ffi.h... *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--enable-system-libffi
--disable-system-libffi
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
from extconf.rb:10:in `system_libffi_usable?'
from extconf.rb:42:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.13.1/mkmf.log
Still having this problem, but I have managed to workaround this by installing another ruby version using Homebrew.
But if anyone managed to solve it without installing homebrew ruby, let
us know.
need install packages and dependencies
brew install make
brew install ruby-build
brew install ruby-completion
brew install ruby
brew install autogen
brew install libffi
brew install rvm
after install check environment path.
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export CPPFLAGS="-I/usr/local/opt/libffi/include"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
now retrieve your env shell
source ~/.zshrc

Installing 'Compass' via the command line receive error "extconf failed, exit code 1"

Couldn't find an answer to this.
Running OS X Yosemite Beta v2
When following compass install guide ensure that your gem is up-to-date
gem update --system
Then run
gem install compass
Assuming your installation failed for the same reason as mine, you'll notice that the error logs states:
"You have to install development tools first."
So, install xcode and try:
xcode-select --install
Follow the onscreen instructions and you should be golden. For reference, this is the error I received when attempting
Computer:Folder User$ sudo gem install compass
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20140904-3376-i1l5f8.rb extconf.rb
checking for ffi.h... *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:16:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/ffi-1.9.3/gem_make.out
If you have XCODE installed, you need to open.
Because the OS needs to add components and these are added when you open the app.
Try again run
sudo gem install compass
Enjoy!
Got the same issue, also used xcode-select --install but not help.
I have to download correct dmg from here https://developer.apple.com/downloads/?name=for%20Xcode

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

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.

RedCloth makefile error when trying to run bundle install for Octopress

I've just pulled down Octopress from Git ( github.com/imathis/octopress.git octopress ) to my local machine, but when I try to run bundle install per the instructions, ( http://octopress.org/docs/setup/ ) I get a make error. I'm running version 3.2 of Xcode--do I need to update to 4.x from the Apple Developer site?
I'm also running Ruby 1.9.2p180 per RVM. Do I need to run a more recent version?
Here's the output when I try to run sudo gem install RedCloth:
Building native extensions. This could take a while...
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.2-p180/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=/Users/user/.rvm/rubies/ruby-1.9.2-p180/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
/Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The
complier failed to generate an executable file. (RuntimeError) You have to install
development tools first.
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:748:in `block in
have_library'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:693:in `block in
checking_for'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:280:in `block (2
levels) in postpone'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:280:in `block in
postpone'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:692:in
`checking_for'
from /Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/mkmf.rb:743:in
`have_library'
from extconf.rb:5:in `<main>'
Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/RedCloth-
4.2.8 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/RedCloth-
4.2.8/ext/redcloth_scan/gem_make.out
You should try running Ruby 1.9.2-p290.
rvm install 1.9.2 && rvm use 1.9.2
this fixed the error for me..
sudo apt-get install ruby1.9.1-full
sudo update-alternatives --config ruby
(it seems the error is caused when some of the ruby1.9.1-dev build files/config are missing)

Resources