I am trying to install rails and I keep getting the following error,
I have install developer tools but this didn't fix the problem.
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/stel/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150928- 21021-11g7r42.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/stel/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
--help
--clean
/Users/stel/.rvm/rubies/ruby-2.2.1/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 /Users/stel/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /Users/stel/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /Users/stel/.rvm/rubies/ruby-2.2.1/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 /Users/stel/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:337:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/stel/.rvm/rubies/ruby- 2.2.1/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/stel/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2/gem_make.out
Petross-Mini:~ stel$ bundle config build.nokogiri --use-system-libraries
-bash: bundle: command not found
You have to install ruby with rvm or rbenv . Otherwise It will create a problem. Use the following steps.
#Install rvm
\curl -sSL https://get.rvm.io | bash -s stable
#Install ruby version 2.0.0-p451
rvm install ruby-2.0.0-p451
Related
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.10.1/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20190304-9093-ehjkih.rb extconf.rb
checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... * 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.3/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456: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.3/usr/lib/ruby/2.3.0/mkmf.rb:571:inblock in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:522:in with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:571:intry_compile'
from extconf.rb:138:in nokogiri_try_compile'
from extconf.rb:162:inblock in add_cflags'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:629:in with_cflags'
from extconf.rb:161:inadd_cflags'
from extconf.rb:416:in `'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-16/2.3.0/nokogiri-1.10.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.10.1 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-16/2.3.0/nokogiri-1.10.1/gem_make.out
first, run this command
sudo apt-get -f install
then, run this command
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
this will install dependencies. gem native extension successfully build.
I try to install the gem charlock_holmes_bundle_icu -v '0.6.9.2'
but I receive this error:
Building native extensions. This could take a while...
ERROR: Error installing charlock_holmes_bundle_icu:
ERROR: Failed to build gem native extension.
current directory: /Users/agatheloubert/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/charlock_holmes_bundle_icu-0.6.9.2/ext/charlock_holmes
/Users/agatheloubert/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20180306-35008-vbolm2.rb extconf.rb
-- tar zxvf icu4c-49_1_2-src.tgz
-- LDFLAGS= CXXFLAGS="-O2 -fPIC" CFLAGS="-O2 -fPIC" ./configure --prefix=/Users/agatheloubert/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/charlock_holmes_bundle_icu-0.6.9.2/ext/charlock_holmes/dst/ --disable-tests --disable-samples --disable-icuio --disable-extras --disable-layout --enable-static --disable-shared
-- make install
*** 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/agatheloubert/.rbenv/versions/2.4.1/bin/$(RUBY_BASE_NAME)
extconf.rb:7:in `sys': make install failed, please report issue on http://github.com/brianmario/charlock_holmes (RuntimeError)
from extconf.rb:33:in `block (2 levels) in <main>'
from extconf.rb:31:in `chdir'
from extconf.rb:31:in `block in <main>'
from extconf.rb:27:in `chdir'
from extconf.rb:27:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/agatheloubert/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/charlock_holmes_bundle_icu-0.6.9.2 for inspection.
Results logged to /Users/agatheloubert/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-17/2.4.0-static/charlock_holmes_bundle_icu-0.6.9.2/gem_make.out
Do you know how to do it?
Uninstalling and reinstalling solved the issue for me.
gem uninstall charlock_holmes
gem install charlock_holmes -- --with-icu-dir=/usr/local/Custom/icu
You can use sudo for su permissions.
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.
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.
I have been trying to install Ruby on Rails based on these instructions. However, I am getting the following error upon running gem install rails -v 4.2.4:
Fetching: rack-1.6.4.gem (100%)
Successfully installed rack-1.6.4
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/home/falak/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20150909-22683-172bl7d.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/falak/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/falak/.rvm/rubies/ruby-2.2.3/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/falak/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /home/falak/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /home/falak/.rvm/rubies/ruby-2.2.3/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/falak/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:337:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /home/falak/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /home/falak/.rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out
I tried installing nokogiri using system libraries by running gem install nokogiri -v 1.6.2.1 -- --use-system-libraries, but I got the following error:
Building native extensions with: '--use-system-libraries'
This could take a while...
Building nokogiri using system libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/falak/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20150909-23169-twqmu6.rb extconf.rb --use-system-libraries
Building nokogiri using system libraries.
*** 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/falak/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
/home/falak/.rvm/rubies/ruby-2.2.3/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/falak/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
from /home/falak/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
from /home/falak/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:637:in `try_ldflags'
from /home/falak/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:1780:in `pkg_config'
from extconf.rb:338:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /home/falak/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /home/falak/.rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/nokogiri-1.6.2.1/gem_make.out
Try installing the libgmp-dev library
apt-get install libgmp-dev
Using RVM to install rails in ruby 2.2.3 has been a major problem among other users as well. For now, you can still get rails 4.2.4 in ruby 2.2.2.
Try:
rvm install 2.2.2
rvm --default use 2.2.2
gem install rails
this should still work. RVM for some reason does not install the right headers in 2.2.3 for you to build the gems.
For OS X users: remember update the Xcode command line developer tools, this is the problem for the 99% OS X users. xcode-select --install
You can try this amazing solution for this
The solution is:
sudo apt-get install ruby-dev
Or, if that doesn't work, depending on your ruby version, run something like:
sudo apt-get install ruby1.9.1-dev
Should fix your problem.
Still not working? Try the following after installing ruby-dev:
sudo apt-get install make
This solution is for nokogiri error:
sudo apt-get install ruby-dev
As the error says check in the mkmf.log file. There you'll find the missing header files.
In my case I was missing zlib.h. The error was:
The #include file "zlib.h" is not found
So to fix it:
sudo apt-get install zlib1g-dev
To find required dev packages, one can use apt-file
$ apt-file search zlib.h
zlib1g-dev: /usr/include/zlib.h