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.
Related
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.
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
Trying to install nokogiri on Mountain Lion. I was using ruby 1.8.7 but just upgraded to 1.9.3 but it stopped the bundle install from working.
Incidentally, I could get round this problem by uninstalling ruby 1.9.3 and reverting to 1.8.7. however this is obviously a suboptimal solution since I don't want to be stuck on 1.8.7 for the rest of time...
Users-MacBook-Pro:sample_app user$ ls
Gemfile app doc script
Gemfile.lock config lib spec
README.md config.ru log tmp
Rakefile db public vendor
Ravins-MacBook-Pro:sample_app user$ bundle
Fetching gem metadata from https://rubygems.org/.......
/Users/user/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.1/lib/bundler.rb:263: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Using rake (0.9.2.2)
Using i18n (0.6.1)
Using multi_json (1.3.6)
Using activesupport (3.2.8)
Using builder (3.0.3)
Using activemodel (3.2.8)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.8)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.8)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.8)
Using activeresource (3.2.8)
Using addressable (2.3.2)
Installing nokogiri (1.5.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
extconf.rb:86: warning: Insecure world writable dir /usr/local in PATH, mode 040777
checking for libxml/parser.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=/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--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-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-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-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-pkg-config
--without-pkg-config
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--with-libiconv-config
--without-libiconv-config
--with-pkg-config
--without-pkg-config
/Users/user/.rvm/rubies/ruby-1.9.3-p194/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 /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/user/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
from extconf.rb:114:in `<main>'
Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.5.5), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.5'` succeeds before bundling.
I have downloaded XCODE including the developer tools, so I do not know why it won't install nokogiri...
When I try to install nokogiri directly, I get:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
extconf.rb:86: warning: Insecure world writable dir /usr/local in PATH, mode 040777
checking for libxml/parser.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=/Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--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-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-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-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-pkg-config
--without-pkg-config
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--with-libiconv-config
--without-libiconv-config
--with-pkg-config
--without-pkg-config
/Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/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 /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/ravinthambapillai/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
from extconf.rb:114:in `<main>'
Gem files will remain installed in /Users/ravinthambapillai/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5 for inspection.
Results logged to /Users/ravinthambapillai/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5/ext/nokogiri/gem_make.out
thanks,
After short research I find out what problem can be simply solved by creating symbolic link
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
works for me hope for you too
gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/morozovm/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
checking for libxml/parser.h... *** extconf.rb failed ***
bash-3.2$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Password:
bash-3.2$ gem install nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.5.6
1 gem installed
Try these. I faced the same issue and it worked for me. First install libxml2 and then run bundler again.
brew install libxml2
brew link libxml2
Source: http://decielo.com/articles/11/rails-3-on-lion-hey-ho-lets-go
Update:
I am hoping that you have homebrew installed. If you don't have homebrew then I will suggest you to install homebrew and then install libxml2 and then bundler. Don't use mac ports in case you don't have homebrew.
Update:
It's not an issue of command line tools. It's failing at libxml. Try to read the error and you will see
checking for libxml/parser.h... *** extconf.rb failed ***
And that's the issue
I think this is the most important bit of the error message:
warning: Insecure world writable dir /usr/local in PATH, mode 040777
Some part of the build process is whining that that directory has permissions such that anyone can write to it. You could try to hunt it down - or you could fix it.
I've been experiencing a lot of problems with this gem, so I read that I had to use de 1.5.0-beta.
Since I'm using windows, I downloaded DevKit. But when I ran:
gem install nokogiri --pre -- --with-xml2-lib --with-xslt-lib
I get:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
C:/Ruby187/bin/ruby.exe extconf.rb --with-xml2-lib --with-xslt-lib --pla
taform=ruby
*** 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:/Ruby187/bin/ruby
--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-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib=${xml2-dir}/lib
C:/Ruby187/lib/ruby/1.8/mkmf.rb:1177:in `dir_config': private method `split' cal
led for true:TrueClass (NoMethodError)
from extconf.rb:87
Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/nokogiri-1.
5.0.beta.4 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/nokogiri-1.5.0.beta.4/ext/no
kogiri/gem_make.out
What can I do?
With a command like
gem install nokogiri --pre -- --with-xml2-lib --with-xslt-lib
it looks like you're trying to install the very latest version of nokogiri. Try specifying a precise version with --version.
Also note the following requirements for nokogiri 1.6+
ruby 1.9.3 or higher
in Nokogiri 1.6.0 and later, libxml2 and libxslt are no longer requirements
So, if you do want to use ruby 1.8.7 (which is EOL, btw) then, yes, you do need to specify nokogiri < 1.6. However, if you can use a modern, living ruby, then you might dodge the lib dependencies.