New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle install fails due to nokogiri 1.6.8 problem #227

Closed
mikelupo opened this Issue Jun 9, 2016 · 21 comments

Comments

Projects
None yet
@mikelupo

mikelupo commented Jun 9, 2016

Yosemite 10.10.5
This was working, and now suddenly it has stopped.
The command and it's subsequent output as well as mkmf.log snippet is included below.

I notice that some of my Jenkins Mac Mini slaves when running the bundle install command install nokogiri 1.6.7.2, this one which is experiencing the failure is trying to install nokogiri 1.6.8.
What makes this difference?
============= bundle install ==============
bundle install
Fetching gem metadata from https://rubygems.org/...............
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Rubygems 2.0.14 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using claide 1.0.0
Using clamp 0.6.5
Using colored 1.2
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using bundler 1.11.2
Using tzinfo 1.2.2
Installing nokogiri 1.6.8 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --use-system-libraries

Using pkg-config version 1.1.7
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.
checking for libxml-2.0... no
checking for libxslt... no
checking for libexslt... no
ERROR: cannot discover where libxml2 is located on your system. please make sure pkg-config is installed.
*** 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-pkg-config
--without-pkg-config
--with-override-variables
--without-override-variables
--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-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
--with-pkg-config
--without-pkg-config

Gem files will remain installed in /var/folders/8r/84r5yjgs6g79sncp7rjqflnr0000gq/T/bundler20160609-42888-n8l47cnokogiri-1.6.8/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/folders/8r/84r5yjgs6g79sncp7rjqflnr0000gq/T/bundler20160609-42888-n8l47cnokogiri-1.6.8/gems/nokogiri-1.6.8/ext/nokogiri/gem_make.out
Using activesupport 4.2.6
An error occurred while installing nokogiri (1.6.8), and Bundler cannot continue.
Make sure that gem install nokogiri -v '1.6.8' succeeds before bundling.

=============== SNIP mkmf.log ==============
"xcrun clang -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS -Wno-error=unused-command-line-argument-hard-error-in-future -arch x86_64 -arch i386 -c conftest.c"
warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
1 warning generated.
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: int main() {return 0;}
/
end */

package configuration for libxslt is not found
have_package: checking for libxslt... -------------------- no

DL is deprecated, please use Fiddle

package configuration for libexslt is not found
have_package: checking for libexslt... -------------------- no


"xcrun clang -E -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2/ -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libxml/xmlversion.h' file not found

include <libxml/xmlversion.h>

     ^

1 error generated.
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <libxml/xmlversion.h>
/
end */

@neonichu

This comment has been minimized.

Show comment
Hide comment
@neonichu

neonichu Jun 9, 2016

Member

bundle install will pick the newest available version satisfying a requirement, unless you specify concrete versions or upper bounds in the Gemfile.

You can check out http://buegling.com/blog/2015/4/26/building-nokogiri-on-os-x for some nokogiri installation troubleshooting advice.

Member

neonichu commented Jun 9, 2016

bundle install will pick the newest available version satisfying a requirement, unless you specify concrete versions or upper bounds in the Gemfile.

You can check out http://buegling.com/blog/2015/4/26/building-nokogiri-on-os-x for some nokogiri installation troubleshooting advice.

@neonichu neonichu closed this Jun 9, 2016

@mikelupo

This comment has been minimized.

Show comment
Hide comment
@mikelupo

mikelupo Jun 9, 2016

Thank you @neonichu! That was helpful.

mikelupo commented Jun 9, 2016

Thank you @neonichu! That was helpful.

@mikelupo

This comment has been minimized.

Show comment
Hide comment
@mikelupo

mikelupo Jun 30, 2016

@brendangillies I think what I had to do was to force the install of Nokogiri 1.6.7.2 first.
Then I was able to install the slather gem.

-----Original Message-----
From: brendangillies notifications@github.com
To: SlatherOrg/slather slather@noreply.github.com
Cc: mikelupo mikelupo@aol.com; Author author@noreply.github.com
Sent: Thu, Jun 30, 2016 11:37 am
Subject: Re: [SlatherOrg/slather] Bundle install fails due to nokogiri 1.6.8 problem (#227)

How did you solve this?? Struggling with the same issue but am not able to find the answer here...

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

mikelupo commented Jun 30, 2016

@brendangillies I think what I had to do was to force the install of Nokogiri 1.6.7.2 first.
Then I was able to install the slather gem.

-----Original Message-----
From: brendangillies notifications@github.com
To: SlatherOrg/slather slather@noreply.github.com
Cc: mikelupo mikelupo@aol.com; Author author@noreply.github.com
Sent: Thu, Jun 30, 2016 11:37 am
Subject: Re: [SlatherOrg/slather] Bundle install fails due to nokogiri 1.6.8 problem (#227)

How did you solve this?? Struggling with the same issue but am not able to find the answer here...

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@myseven

This comment has been minimized.

Show comment
Hide comment
@myseven

myseven Aug 24, 2016

maybe you need to update your ruby

myseven commented Aug 24, 2016

maybe you need to update your ruby

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Aug 31, 2016

I had the same error, only solution that worked for me on OSX:

xcode-select --install
gem install nokogiri

from here: http://stackoverflow.com/a/34653921

ghost commented Aug 31, 2016

I had the same error, only solution that worked for me on OSX:

xcode-select --install
gem install nokogiri

from here: http://stackoverflow.com/a/34653921

@ptibbetts

This comment has been minimized.

Show comment
Hide comment
@ptibbetts

ptibbetts Sep 22, 2016

I've just updated to macOS Sierra and had this issue, installing the command line tools as mentioned above by @ts-silvio worked for me

ptibbetts commented Sep 22, 2016

I've just updated to macOS Sierra and had this issue, installing the command line tools as mentioned above by @ts-silvio worked for me

@SteveOscar

This comment has been minimized.

Show comment
Hide comment
@SteveOscar

SteveOscar Sep 24, 2016

As @ptibbetts said, I've just updated to Sierra, trying to start a Rails 5 project, @ts-silvio 's answer got me past the Nokogiri error.

SteveOscar commented Sep 24, 2016

As @ptibbetts said, I've just updated to Sierra, trying to start a Rails 5 project, @ts-silvio 's answer got me past the Nokogiri error.

@sleekweasel

This comment has been minimized.

Show comment
Hide comment
@sleekweasel

sleekweasel Sep 26, 2016

I tried xcode-select to choose 7.3.1 instead of xcode-8, but bundle install still failed with the same error.

What worked for me was (with 7.3.1 still selected, 8.0 might have worked) 'brew install libxml2' and then 'gem install nokogiri -v 1.6.8.rc3'. Brew warned about libxml2 already being provided, and said it wasn't going to link it into /usr/local because it was 'keg-only'.

We don't want to upgrade this system to Sierra yet in case Apple's broken yet another part of our set-up.

sleekweasel commented Sep 26, 2016

I tried xcode-select to choose 7.3.1 instead of xcode-8, but bundle install still failed with the same error.

What worked for me was (with 7.3.1 still selected, 8.0 might have worked) 'brew install libxml2' and then 'gem install nokogiri -v 1.6.8.rc3'. Brew warned about libxml2 already being provided, and said it wasn't going to link it into /usr/local because it was 'keg-only'.

We don't want to upgrade this system to Sierra yet in case Apple's broken yet another part of our set-up.

@jayleicn

This comment has been minimized.

Show comment
Hide comment
@jayleicn

jayleicn Oct 4, 2016

For Sierra, the following code solved my problem (ERROR: Failed to build gem native extension.)

brew unlink gcc-4.2      # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri

Reference, http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x

jayleicn commented Oct 4, 2016

For Sierra, the following code solved my problem (ERROR: Failed to build gem native extension.)

brew unlink gcc-4.2      # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri

Reference, http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x

@cmavromoustakos

This comment has been minimized.

Show comment
Hide comment
@cmavromoustakos

cmavromoustakos Oct 7, 2016

This fixes it for me:

gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2

cmavromoustakos commented Oct 7, 2016

This fixes it for me:

gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2
@Lax

This comment has been minimized.

Show comment
Hide comment
@Lax

Lax Oct 9, 2016

xcode-select --install

works for me.

This may happen after I reinstalled Xcode.

Lax commented Oct 9, 2016

xcode-select --install

works for me.

This may happen after I reinstalled Xcode.

@dlamichhane

This comment has been minimized.

Show comment
Hide comment
@dlamichhane

dlamichhane Oct 19, 2016

xcode-select --install works for me. I was unable to build the gem after updating to macOS Sierra

dlamichhane commented Oct 19, 2016

xcode-select --install works for me. I was unable to build the gem after updating to macOS Sierra

@elimcjah

This comment has been minimized.

Show comment
Hide comment
@elimcjah

elimcjah Nov 5, 2016

@ts-silvio has the answer that worked for me:

xcode-select --install
gem install nokogiri

elimcjah commented Nov 5, 2016

@ts-silvio has the answer that worked for me:

xcode-select --install
gem install nokogiri
@bobzhen

This comment has been minimized.

Show comment
Hide comment
@bobzhen

bobzhen Nov 14, 2016

I just uninstall all versions of nokogiri, and reinstall it by following official installation tutorial.

http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x

bobzhen commented Nov 14, 2016

I just uninstall all versions of nokogiri, and reinstall it by following official installation tutorial.

http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x
@timlauter

This comment has been minimized.

Show comment
Hide comment
@timlauter

timlauter Nov 22, 2016

As others have mentioned, it resolved my update to Sierra.

timlauter commented Nov 22, 2016

As others have mentioned, it resolved my update to Sierra.

@netuoso

This comment has been minimized.

Show comment
Hide comment
@netuoso

netuoso Dec 5, 2016

xcode-select --install; bundle install worked for me despite already having command line tools. I suggest to try this first if you are having issues.

netuoso commented Dec 5, 2016

xcode-select --install; bundle install worked for me despite already having command line tools. I suggest to try this first if you are having issues.

@Kcnarf

This comment has been minimized.

Show comment
Hide comment
@Kcnarf

Kcnarf Dec 6, 2016

@ts-silvio's solution xcode-select --install ; bundle install didn't work for me, telling me to install pkg-config.

So I brew install pkg-config, but got Error: The 'brew link' step did not complete successfully.
So I brew link --overwrite pkg-config
And then bundle install works fine

Kcnarf commented Dec 6, 2016

@ts-silvio's solution xcode-select --install ; bundle install didn't work for me, telling me to install pkg-config.

So I brew install pkg-config, but got Error: The 'brew link' step did not complete successfully.
So I brew link --overwrite pkg-config
And then bundle install works fine

@jerryzhoujw

This comment has been minimized.

Show comment
Hide comment
@jerryzhoujw

jerryzhoujw Mar 30, 2017

Follow @cmavromoustakos 's solution. I use
gem install slather -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2

jerryzhoujw commented Mar 30, 2017

Follow @cmavromoustakos 's solution. I use
gem install slather -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2

@Rifinio

This comment has been minimized.

Show comment
Hide comment
@Rifinio

Rifinio Jun 14, 2017

I couldn't install slather on OS Sierra, and i tried almost everything with no success.
ts-silvio is my hero, his solution works great 👍

Rifinio commented Jun 14, 2017

I couldn't install slather on OS Sierra, and i tried almost everything with no success.
ts-silvio is my hero, his solution works great 👍

@DaveCollinsJr

This comment has been minimized.

Show comment
Hide comment
@DaveCollinsJr

DaveCollinsJr Oct 3, 2017

And more than a year later @ts-silvio 's commands worked after an Apple Xcode update. Also make sure you have run Xcode at least once to accept the new terms and conditions.

I am altering the deal... Pray I don't alter it any further.

DaveCollinsJr commented Oct 3, 2017

And more than a year later @ts-silvio 's commands worked after an Apple Xcode update. Also make sure you have run Xcode at least once to accept the new terms and conditions.

I am altering the deal... Pray I don't alter it any further.

@ihouse10

This comment has been minimized.

Show comment
Hide comment
@ihouse10

ihouse10 Dec 20, 2017

Doing bundle update fixes this problem for me. Sometimes you need updating your gems to the latest available versions.

ihouse10 commented Dec 20, 2017

Doing bundle update fixes this problem for me. Sometimes you need updating your gems to the latest available versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment