I am trying to run bundle install after updating the most recent security updates to Rails and Ruby, and cannot install the Nokogumbo gem. I get the following error message:
An error occurred while installing nokogumbo (1.5.0), and Bundler cannot continue.
Make sure that `gem install nokogumbo -v '1.5.0' --source 'https://rubygems.org/'` succeeds before bundling.
I tried running gem install nokogumbo -v '1.5.0' --source 'https://rubygems.org/' and got this:
Building native extensions. This could take a while...
ERROR: Error installing nokogumbo:
ERROR: Failed to build gem native extension.
current directory: /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogumbo-1.5.0/ext/nokogumboc
/Users/<username>/.rbenv/versions/2.6.2/bin/ruby -I /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/2.6.0 -r ./siteconf20190314-8398-fmosg1.rb extconf.rb
checking for xmlNewDoc() in -lxml2... yes
checking for nokogiri.h in /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri... no
checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.9
with the following patches applied:
- 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Activating libxml2 2.9.9 (from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ports/x86_64-apple-darwin18.2.0/libxml2/2.9.9)...
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxslt-1.1.33.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle 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/<username>/.rbenv/versions/2.6.2/bin/$(RUBY_BASE_NAME)
--with-xml2lib
--without-xml2lib
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--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
/Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:293:in `verify_file': Downloaded file '/Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ports/archives/libxslt-1.1.33.tar.gz' has wrong hash: expected: 8e36605144409df979cab43d835002f63988f3dc94d5d3537c12796db90e38c8 is: d020ac32fcb0778e2f636fc31ac205f3f00aceec08c61a090fefa30110daaddc (RuntimeError)
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:61:in `block in extract'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:60:in `each'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:60:in `extract'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:151:in `cook'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri/extconf.rb:365:in `block (2 levels) in process_recipe'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri/extconf.rb:257:in `block in chdir_for_build'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri/extconf.rb:256:in `chdir'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri/extconf.rb:256:in `chdir_for_build'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri/extconf.rb:364:in `block in process_recipe'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri/extconf.rb:262:in `tap'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri/extconf.rb:262:in `process_recipe'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.1/ext/nokogiri/extconf.rb:574:in `<top (required)>'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from extconf.rb:17:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nokogumbo-1.5.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/nokogumbo-1.5.0 for inspection.
Results logged to /Users/<username>/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nokogumbo-1.5.0/gem_make.out
I tried running all the commands that are suggested in that error message as well. With the bundle config command, I got a message that said "You are replacing the current global value of build.nokogiri, which is currently "--use-system-libraries=true" etc.
I also tried manually installing nokogumbo 1.4.7, to see if installing an older version of the gem that I could then upgrade might help. No luck. It doesn't make sense as people who have the same set up as me on their machines have been able to install everything fine.
Anyone have any idea what I could do differently? Thanks!
UPDATE - SOLVED
The fix (for Mojave 10.14) is: gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2 --use-system-libraries
Credit here
I ran into this same issue when trying to run bundler in rails. What worked for me was running
bundle config build.nokogiri --use-system-libraries
bundle config build.nokogumbo --use-system-libraries
bundle install
Setting the --use-system-libraries flag for nokogumbo did the trick.
Related
I am installing Nokogiri gem with bundle install, but its failing with below error in CentOS 6.6. I installed libxml2, libxslt also.
Building native extensions. This could take a while...
ERROR: Error installing nokogiri-1.6.6.2.gem:
ERROR: Failed to build gem native extension.
/usr/bin/ruby -r ./siteconf20160301-19713-3tkoho.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-redhat-linux-gnu/ports/libxml2/2.9.2... OK
Running patch with /usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... ERROR, review '/usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-redhat-linux-gnu/ports/libxml2/2.9.2/patch.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
--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
--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}/lib64
--enable-cross-build
--disable-cross-build
/usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete patch task (RuntimeError)
from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
from extconf.rb:311:in `block in patch'
from extconf.rb:308:in `each'
from extconf.rb:308:in `patch'
from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:108:in `cook'
from extconf.rb:278:in `block in process_recipe'
from extconf.rb:177:in `tap'
from extconf.rb:177:in `process_recipe'
from extconf.rb:475:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /usr/lib64/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out
[root#hh-rcs-push1 gemfiles]#
Fixed with installing rvm(ruby version manager).
I'm installing nokogiri 1.6.6.2 on Arch Linux,as metasploit installation can't proceed without it.
I got the following output:
[ blackarch Downloads ]# gem install ./nokogiri-1.6.6.2.gem
Building native extensions. This could take a while...
ERROR: Error installing ./nokogiri-1.6.6.2.gem:
ERROR: Failed to build gem native extension.
/usr/bin/ruby -r ./siteconf20151103-1360-1u3d2zo.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.2... OK
Running patch with /root/.gem/ruby/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... ERROR, review '/root/.gem/ruby/2.2.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.2/patch.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
--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_BASE_NAME)
--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
/root/.gem/ruby/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete patch task (RuntimeError)
from /root/.gem/ruby/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
from /root/.gem/ruby/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
from extconf.rb:311:in `block in patch'
from extconf.rb:308:in `each'
from extconf.rb:308:in `patch'
from /root/.gem/ruby/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:108:in `cook'
from extconf.rb:278:in `block in process_recipe'
from extconf.rb:177:in `tap'
from extconf.rb:177:in `process_recipe'
from extconf.rb:475:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /root/.gem/ruby/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /root/.gem/ruby/2.2.0/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out
I've tried every possible solution I found, either locally installation or gem install nokogiri doesn't work...
You can try :
bundle config build.nokogiri --use-system-libraries
bundle install
Or you can reseach sth on
nokogiri doc
Try this way:
gem install nokogiri -v 1.6.6.2 -- --use-system-libraries
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri
did it for me
If you are using macOS Mojave, Xcode 10 on macOS Mojave moves the system headers out of /usr/include and so Nokogiri will fail to build.
Here is a workaround from nokogiri official installing guide
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
You should update your gemfile with the nokogiri gem
gem 'nokogiri', '~> 1.6', '>= 1.6.8'
after updating your Gemfile with the line of code above run:
bundle install
I’m starting a Middleman app from scratch. Whenever I attempt to run the server, i.e. middleman server I get an error (below) that tells me “error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue.”
However, when I attempt to install nokogiri (1.6.6.2), I get another error (below) that says me “ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension.”
I then attempt to bundle install my gemfile but receive another error. Can anyone tell me what I might be overlooking?
Whenever I attempt to run my middleman server command, I get this:
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'nokogiri' (>= 1.3.3) among 67 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Wilhelm/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1311:in `block in activate_dependencies'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `activate_dependencies'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1282:in `activate'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1314:in `block in activate_dependencies'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `activate_dependencies'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1282:in `activate'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:67:in `block in gem'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:66:in `synchronize'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:66:in `gem'
from /usr/bin/middleman:22:in `<main>'
Here are the contents of my Gemfile:
# If you do not have OpenSSL installed, update
# the following line to use "http://" instead
source 'https://rubygems.org'
gem "middleman", "~>3.4.0"
# Live-reloading plugin
gem "middleman-livereload", "~> 3.1.0"
# For faster file watcher updates on Windows:
gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]
# Windows does not come with time zone data
gem "tzinfo-data", platforms: [:mswin, :mingw, :jruby]
and here are the results from my bundle install:
Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.4
Using bundler 1.8.2
Using mime-types 2.6.1
Using mini_portile 0.6.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150828-20513-wkpoce.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** 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
--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
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-libxslt-config
--without-libxslt-config
--with-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt-include=${exslt-dir}/include
--with-exslt-lib
--without-exslt-lib=${exslt-dir}/lib
--with-libexslt-config
--without-libexslt-config
extconf failed, exit code 1
Gem files will remain installed in /var/folders/zn/zh_8qnr573x4wgbjz6gqz72w0000gn/T/bundler20150828-20513-11hlulx/nokogiri-1.6.6.2/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /var/folders/zn/zh_8qnr573x4wgbjz6gqz72w0000gn/T/bundler20150828-20513-11hlulx/nokogiri-1.6.6.2/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.6.2/gem_make.out
An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.
and here are the results from my sudo gem install nokogiri -v '1.6.6.2':
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/Wilhelm/.rbenv/versions/1.9.3-dev/bin/ruby extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
-----
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.
To install Command Line Tools, try running `xcode-select --install` on
terminal and follow the instructions. If it fails, open Xcode.app,
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
Tools" to open the developer site, download the installer for your OS
version and run it.
-----
*** 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/Wilhelm/.rbenv/versions/1.9.3-dev/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
Gem files will remain installed in /Users/Wilhelm/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/Wilhelm/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out
I have encountered this on a couple of system configs. It always ends up being a dev library dependency. If it were me, one at a time, I'd install these and try to bundle install:
libxslt-dev
libxml2-dev
ruby-dev
Depending on your system (I think on centos they are -devel not -dev).
This command:
sudo gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2 --use-system-libraries
found in this github issue, solved my problem. Honestly, I'm not entirely sure why so if anyone could append a comment, elucidating what exactly is going on it would be much appreciated.
I have a new set up, and I keep getting an error when I am trying to install rails. I have used RVM to use ruby 2.2.2, and I have checked through the config files.
I have followed various tutorials. I have uninstalled gcc ( though i may reinstall xcode )
and I have gone through various tutorials on how to install this
gem install rails [9:00:49]
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/rrobin008c/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150812-28205-1wdgrip.rb extconf.rb
checking if the C compiler accepts -O2 -arch x86_64... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-apple-darwin14.4.0/ports/libxml2/2.9.2... OK
Running patch with /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... OK
Running patch with /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch...
Running 'patch' for libxml2 2.9.2... OK
Running 'configure' for libxml2 2.9.2... ERROR, review '/Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-apple-darwin14.4.0/ports/libxml2/2.9.2/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
--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/rrobin008c/.rvm/rubies/ruby-2.2.2/bin/$(RUBY_BASE_NAME)
--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
/Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete configure task (RuntimeError)
from /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
from /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
from /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:66:in `configure'
from /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/mini_portile-0.6.2/lib/mini_portile.rb:109:in `cook'
from extconf.rb:278:in `block in process_recipe'
from extconf.rb:177:in `tap'
from extconf.rb:177:in `process_recipe'
from extconf.rb:475:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/rrobin008c/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/rrobin008c/.rvm/gems/ruby-2.2.2/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2/gem_make.out
Manually install nokogiri
gem install nokogiri -v VERSION_YOU_WANT -- --use-system-libraries
Check out "nokogiri gem installation error".
Before you run bundle install, run:
bundle config build.nokogiri --use-system-libraries
or
gem install nokogiri -- --use-system-libraries
After that you can run:
bundle install
For other bugs read the Nokogiri install documentation.
I went through the various tutorials and my output looked like this:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/rrobin008c/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150812-2574-6ejap3.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling breakpoint.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [breakpoint.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/rrobin008c/.rvm/gems/ruby-2.2.1/gems/byebug-5.0.0 for inspection.
Results logged to /Users/rrobin008c/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/byebug-5.0.0/gem_make.out
An error occurred while installing byebug (5.0.0), and Bundler cannot continue.
Make sure that `gem install byebug -v '5.0.0'` succeeds before bundling.
The significant part is
make: /usr/bin/gcc-4.2: No such file or directory
After this I asked:
$which gcc
/usr/bin/gcc
Follow "OS X Mountain Lion: gcc-4.2 No such file or directory" and everything should work after that.
I would recommend running
brew doctor
rvm reinstall
rvm reinstall (ruby version here)
gem pristine all
sudo gem install rails
If you get to many error best thing to do is remove rails and ruby completely
first type this
tarun#tarun:~$ which ruby
/home/tarun/.rbenv/shims/ruby
tarun#tarun:~$ which rails
/home/tarun/.rbenv/shims/rails
then copy the path and use this command to remove the file
rm -rf /home/tarun/.rbenv/shims/ruby
rm -rf /home/tarun/.rbenv/shims/rails
and same way you can check which rbenv and which rvm and remove by using this same method.
And use
grep -rl rails
grep -rl ruby
this will show path of all files which have rails keyword.So that you can know that have you removed rails and ruby completely.
And follow steps given here to reinstall it
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-14-04
When I install rails in macOS by running
$ sudo gem install rails
I got the following.
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150702-37637-10z8fhh.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-apple-darwin14/ports/libxml2/2.9.2... OK
Running patch with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... OK
Running patch with /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch...
Running 'patch' for libxml2 2.9.2... OK
Running 'configure' for libxml2 2.9.2... OK
Running 'compile' for libxml2 2.9.2... ERROR, review '/Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-apple-darwin14/ports/libxml2/2.9.2/compile.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
--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
--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
/Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete compile task (RuntimeError)
from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:70:in `compile'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:110:in `cook'
from extconf.rb:278:in `block in process_recipe'
from extconf.rb:177:in `tap'
from extconf.rb:177:in `process_recipe'
from extconf.rb:475:in `<main>'
extconf failed, exit code 1
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/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.6.2/gem_make.out
Building gems with native extensions is always a pain. You need to have several libs or compile tools installed. In case of nokogiri it's libxml. For this reason i would recommend to use rvm for getting started. RVM is not the cleanest tool, when it comes to unix philosophy, but it's a full-stack solution, meaning that it just works out of the box. It will install all the dependencies for you, using the default osx package manager. As a package manager i recommend homebrew.
#install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#install rvm into $HOME
brew install gpg
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
rvm install ruby --latest
gem install rails #no sudo, as ruby is in $HOME