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

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

Related

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 install knife-ec2 error

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

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.

Problems in installing thin on windows 7

I am new to ruby. I am trying to install a ruby gem thin. It shows an error in installing the gem. I googled for the error but i could not find a link that addresses my problem.
The error is:
C:\Users\name\Desktop>ruby -v
ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
C:\Users\name\Desktop>gem -v
2.0.3
C:\Users\name\Desktop>gem install thin
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing thin:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe 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=C:/Ruby200/bin/ruby
--with-thin_parser-dir
--without-thin_parser-dir
--with-thin_parser-include
--without-thin_parser-include=${thin_parser-dir}/include
--with-thin_parser-lib
--without-thin_parser-lib=${thin_parser-dir}/
--with-clib
--without-clib
C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:515:in `try_link0'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:530:in `try_link'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:716:in `try_func'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:946:in `block in have_library'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:891:in `block in checking_for'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:336:in `block (2 levels) in postpone'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:306:in `open'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:336:in `block in postpone'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:306:in `open'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:332:in `postpone'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:890:in `checking_for'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:941:in `have_library'
from extconf.rb:4:in `<main>'
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/thin-1.6.0 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/thin-1.6.0/ext/thin_parser/gem_make.out
C:\Users\name\Desktop>
Any help truly appreciated. Thanks.
I resolved the problem by following these steps. Posting this answer as it might be useful for others.
I uninstalled and deleted all the ruby stuff and restarted the machine. Downloaded Ruby 2.0 and Devkit from here http://rubyinstaller.org/downloads/.
Installed ruby and devkit. Install devkit using the instructions given in this link https://github.com/oneclick/rubyinstaller/wiki/Development-Kit.
cd to ruby folder and installed rails, thin gem

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