Failed to build gem native extension - During Rails Installation - ruby-on-rails

I'm trying to install Ruby on Rails, but I keep getting this error message:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
I don't know what to do, I've tried searching online for answers, such as installing command line tools, gcc, and others I can't remember, but to no effect. I often get errors doing things that others have said are suppose to resolve the problem too.
Here is the entire error message:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
/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:500: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 extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:599:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:337:in `<main>'
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out

Related

gem install rails -v '4.2.4' failed to compile

Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /home/nagaraju/.rvm/gems/ruby-2.2.4#maxmywealth/gems/nokogiri-1.6.7.2/ext/nokogiri
/home/nagaraju/.rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160226-5567-umlwr8.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=/home/nagaraju/.rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/nagaraju/.rvm/gems/ruby-2.2.4#maxmywealth/extensions/x86_64-linux/2.2.0/nokogiri-1.6.7.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/nagaraju/.rvm/gems/ruby-2.2.4#maxmywealth/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /home/nagaraju/.rvm/gems/ruby-2.2.4#maxmywealth/extensions/x86_64-linux/2.2.0/nokogiri-1.6.7.2/gem_make.out
As mentioned in the comments, you have to install developer tools first. Which is a simple command in the terminal:
xcode-select --install
After the installation is complete. Try installing rails.
Let us know, otherwise.

How to fix an error installing Rails on Fedora

I am a newcomer to Fedora and Rails and do not know how to solve this problem. Here is the error message:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /usr/local/share/gems/gems/nokogiri-1.6.7.2/ext/nokogiri
/usr/bin/ruby -r ./siteconf20160209-8980-yntffh.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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:571:in `block in try_compile'
from /usr/share/ruby/mkmf.rb:522:in `with_werror'
from /usr/share/ruby/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /usr/share/ruby/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib64/gems/ruby/nokogiri-1.6.7.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/share/gems/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /usr/local/lib64/gems/ruby/nokogiri-1.6.7.2/gem_make.out
The key message here is
You have to install development tools first.
which should be installed with
dnf install #development-tools
See "What is the Fedora equivalent of the Debian build-essential package?" for more information.

Getting a error when trying to add the stripe gem

I am trying to install the stripe gem and I'm getting this error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/bin/ruby -r ./siteconf20151005-1267-af6sn6.rb extconf.rb checking for main() in
-lstdc++... * 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/Fysh/.rvm/rubies/ruby-2.0.0-p643/bin/ruby
--with-static-libstdc++ --without-static-libstdc++ --with-stdc++lib
--without-stdc++lib
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/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/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:519:in
try_link0' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:534:in
try_link' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:714:in
try_func' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:944:in
block in have_library' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:889:in
block in checking_for' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:340:in
block (2 levels) in postpone' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:310:in
open' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:340:in
block in postpone' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:310:in
open' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:336:in
postpone' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:888:in
checking_for' from
/Users/Fysh/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/mkmf.rb:939:in
have_library' from extconf.rb:6:in'
extconf failed, exit code 1
Gem files will remain installed in
/Users/Fysh/.rvm/gems/ruby-2.0.0-p643/gems/unf_ext-0.0.7.1 for
inspection. Results logged to
/Users/Fysh/.rvm/gems/ruby-2.0.0-p643/extensions/x86_64-darwin-14/2.0.0-static/unf_ext-0.0.7.1/gem_make.out
An error occurred while installing unf_ext (0.0.7.1), and Bundler
cannot continue. Make sure that gem install unf_ext -v '0.0.7.1'
succeeds before bundling.
Solved had an xcode update after I updated it worked.

gem install compass not working

having trouble running the line gem install compass in terminal. It's returning the following error. Is anyone able to help out with this problem?
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby -r ./siteconf20150225-51908-cfetpz.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=/usr/local/rvm/rubies/ruby-1.9.3-p392/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}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/local/rvm/rubies/ruby-1.9.3-p392/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 /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:506:in
try_cpp'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:931:in
block in have_header'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:790:in
block in checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in
block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in
block in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:280:in
postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:789:in
checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:930:in
have_header'
from extconf.rb:16:in'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ffi-1.9.6 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/extensions/x86_64-darwin-10/1.9.1-static/ffi-1.9.6/gem_make.out
The error you're getting is
(RuntimeError)
You have to install development tools first.
If you're on OS X (my best guess from the output) you need to install the Xcode developer tools first. You can do this with the command: xcode-select --install.

Ruby on Rails: Problems debuggin an app

I am having problems in order to debug an app using ruby-debug with RadRails.
I try to install the gem with gem install ruby-debug19 -as I am using Ruby 1.9.1-p249 but I get the following error:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:>gem install ruby-debug19
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug19:
ERROR: Failed to build gem native extension.
C:/Ruby191/bin/ruby.exe extconf.rb
checking for vm_core.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=C:/Ruby191/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:364:in try_do': The complier failed
to genera
te an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:433:intry_cpp'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:811:in block in
have_header'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:670:inblock in
checking_for'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:276:in block (2 levels)
in postp
one'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:250:inopen'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:276:in block in
postpone'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:250:inopen'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:272:in postpone'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:669:inchecking_for'
from C:/Ruby191/lib/ruby/1.9.1/mkmf.rb:810:in have_header'
from extconf.rb:15:inblock in '
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/ruby
_core_source.rb:18:in call'
from
C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/ruby
_core_source.rb:18:increate_makefile_with_core'
from extconf.rb:20:in `'
Gem files will remain installed in
C:/Ruby191/lib/ruby/gems/1.9.1/gems/linecache
19-0.5.11 for inspection.
Results logged to
C:/Ruby191/lib/ruby/gems/1.9.1/gems/linecache19-0.5.11/ext/tra
ce_nums/gem_make.out
C:>
Thanks in advance!
Just guessing... it didn't find vm_core.h, so you have to set that path using -I<path>.
If I may suggest you something for less pain, use Virtualbox + ubuntu + rvm.
Just installed RubyInstaller 1.9.2 and worked

Resources