sparklemotion / nokogiri

Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
https://nokogiri.org/
MIT License
6.14k stars 896 forks source link

OSX install problem (1.6.5, 1.6.6.2) #1231

Closed jjb closed 9 years ago

jjb commented 9 years ago
➔ uname -a
Darwin johns-MBP 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
➔ rbenv version
2.1.5 (set by /Users/john/.rbenv/version)
➔ gem install nokogiri -v '1.6.6.1'
Fetching: nokogiri-1.6.6.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /Users/john/.rbenv/versions/2.1.5/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... 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-apple-darwin14.0.0/ports/libxml2/2.9.2... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/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... OK
Running 'install' for libxml2 2.9.2... OK
Activating libxml2 2.9.2 (from /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/x86_64-apple-darwin14.0.0/libxml2/2.9.2)...
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxslt-1.1.28
with the following patches applied:
    - 0001-Adding-doc-update-related-to-1.1.28.patch
    - 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
    - 0003-Initialize-pseudo-random-number-generator-with-curre.patch
    - 0004-EXSLT-function-str-replace-is-broken-as-is.patch
    - 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
    - 0007-Separate-function-for-predicate-matching-in-patterns.patch
    - 0008-Fix-direct-pattern-matching.patch
    - 0009-Fix-certain-patterns-with-predicates.patch
    - 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
    - 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
    - 0014-Fix-for-bug-436589.patch
    - 0015-Fix-mkdir-for-mingw.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
************************************************************************
Extracting libxslt-1.1.28.tar.gz into tmp/x86_64-apple-darwin14.0.0/ports/libxslt/1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0008-Fix-direct-pattern-matching.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0014-Fix-for-bug-436589.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/patches/libxslt/0015-Fix-mkdir-for-mingw.patch...
Running 'patch' for libxslt 1.1.28... OK
Running 'configure' for libxslt 1.1.28... OK
Running 'compile' for libxslt 1.1.28... OK
Running 'install' for libxslt 1.1.28... OK
Activating libxslt 1.1.28 (from /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28)...
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** 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/john/.rbenv/versions/2.1.5/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
    --with-xml2lib
    --without-xml2lib
    --with-libxml2lib
    --without-libxml2lib

extconf failed, exit code 1

Gem files will remain installed in /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.1 for inspection.
Results logged to /Users/john/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/nokogiri-1.6.6.1/gem_make.out
flavorjones commented 9 years ago

Hi,

Can you please tell me more about your system? What version of OSX, what version of XCode and clang, whether you're using homebrew and if so what version ...

I cannot reproduce this locally. Help me reproduce it?

flavorjones commented 9 years ago

Also, are you able to install Nokogiri 1.6.5 on this machine?

jjb commented 9 years ago

just tried 1.6.5, it has the same problem

i'm using macports not homebrew (which external dependencies does nokogiri have? i thought it didn't have any, which is why i was quick to make this ticket)

xcode 6.1.1

➔ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
➔ clang --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
flavorjones commented 9 years ago

OK, if 1.6.5 also doesn't install, then this is likely to be an environmental issue, as 1.6.5 was a solid release as far as we know.

Please make sure you check the documentation at:

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

and if that doesn't work, check back. Thanks!

jjb commented 9 years ago

Thanks @flavorjones. Unfortunately, none of those tips apply to me.

Note that this is the issue:

libxml2 is missing. Please locate mkmf.log to investigate how it is failing.

Have you seen that lately? Isn't it quite odd that this happens, since nokogiri packages and builds its own?

Here is the mkmf.log: http://cl.ly/2s2I0N2J0b1K

It has libxml2 errors that are meaningless to me, maybe you can make sense of them.

jjb commented 9 years ago

(accidental ticket close. /me shakes fist at github form button ordering)

aeberlin commented 9 years ago

(EDIT: Sorry, my issue was due to #1230)

Cheers!

flavorjones commented 9 years ago

I've updated the title to reflect that you are having issues generally, not just with 1.6.6.1 or 1.6.6.2 -- as you indicate that you cannot install 1.6.5.

flavorjones commented 9 years ago

Can you please provide a unified set of log files? The stdout snippet you provide in the OP is nokogiri 1.6.6.1 but the mkmf.log is from 1.6.6.2. I want to make sure we're looking at the same event in the two log files, and not two separate events/causes.

Also, can you please use github gists to post the log files? Thanks.

jjb commented 9 years ago

@flavorjones Whoops, sorry about that.

here is everything: https://gist.github.com/jjb/6eba5f2a2eb245a6703e

zenspider commented 9 years ago

Still don't know what version of OSX you're on...

jjb commented 9 years ago

first line of the issue at the very top :)

➔ uname -a
Darwin johns-MBP 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64

(10.10.1 Yosemite)

QuinnyPig commented 9 years ago

10.10.x. Please solve for x.

On Jan 27, 2015, at 9:50 PM, John Bachir notifications@github.com wrote:

first line of the issue at the very top :)

➔ uname -a Darwin johns-MBP 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64 (10.10 Yosemite)

— Reply to this email directly or view it on GitHub.

zenspider commented 9 years ago

That's the version of the darwin kernel you're on. Some nerds might be able to mentally map that to the version of OSX you're on. I'm not one of them.

Better:

% sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.10.2
BuildVersion:   14C109
jjb commented 9 years ago

10.10.1!

enovajuan commented 9 years ago

I was experiencing said issue with 1.6.5, then later with 1.6.6.1, I'm unable to reproduce on 1.6.6.2. But I ended solving the issue with 1.6.5, after upgrading to yosemite. The answer kinda sucks.... I had to first make sure I had latest OSX and build tools then:

  1. brew update and brew upgrade
  2. brew uninstall lib(iconv/xslt/and xml),
  3. brew install latest gcc (i think it's 48 or 49),
  4. brew install all of the libs uninstalled in step 2 --- the part that sucks ---
  5. you have to blow away your ruby(s), I did this on RVM and CHRUBY. Yes ALL OF THEM (or the ones you use)
  6. re-install those rubies (via rvm install command or ruby-install or build them from scratch if you're into that sort of thing... can't help with what all the compile flags would be in that case though)
  7. gem install nokogiri -v '1.6.6.1' or '1.6.5' or bundle install if those are the version in your lock files
  8. success

I'm not sure WHAT the exact problem is, mine only started happening AFTER upgrading to yosemite and already having had built my rubies in OSX 10.9(mavericks). I'm inclined to believe certain libs needed to build nokigiri get moved, or unlinked somehow by the upgrade, or the ruby versions maintain the wrong version of them.

Using the flag to use system libraries or pointing them at the brewed cellar versions of them, did not work for me.

jjb commented 9 years ago

more info: gem install nokogiri -- --use-system-libraries worked without doing anything else

airblair commented 9 years ago

i hate this ish!!! this should just work!

zenspider commented 9 years ago

@blosme thank you SO MUCH for your constructive feedback!

jhroy commented 9 years ago

I had @jjb 's problem. Same OS version. Same issues.

Yet, the --use-system-libraries solution didn't work for me. It generated an error, mentioning that libxml2 version 2.6.21 or later is required, even though I have libxml2-2.9.2 already installed.

After much searching, I found this solution, by Bernt Ankers. I'm posting it here in case other people experience the same thing after upgrading to Yosemite (I so wish I hadn't!!). Nokogiri works again fine!

Just wanna add one thing: Nokogiri is awesome! :smiley_cat:

zenspider commented 9 years ago

@flavorjones please close

jjb commented 9 years ago

No one said above why the issue was closed, so just to clarify, I never figured out why the bundled libxml2 failed to build.

(if the consensus is that our cases are outliers, that's fine, I just wasn't sure!)

Thanks, John

sushilkv2004 commented 9 years ago

Thanks jhroy for your comment. Following from the link you suggested solved my problem:

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

stuartherbert commented 9 years ago

This worked for me, allowing me to get the vagrant-cachier plugin working on OSX:

ARCHFLAGS="-arch x86_64" gem install nokogiri -v '1.6.6.2' --install-dir ~/.vagrant.d/gems/ -- --use-system-libraries
vagrant plugin install vagrant-cachier

Hope it helps someone.

unframework commented 9 years ago

I can confirm that this issue is happening to me on my Yosemite 10.10.2.

The specific problem, to reiterate, is that the gem-bundled libxml2 sources compile correctly but the actual gem compilation fails to find the results:

************************************************************************
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.5/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.5/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... OK
Running 'install' for libxml2 2.9.2... OK
Activating libxml2 2.9.2 (from /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5/ports/x86_64-apple-darwin14/libxml2/2.9.2)...
************************************************************************

Then...

checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** 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.

This is for both versions 1.6.5 and 1.6.6.2.

Attempts to use the brew-installed libxml2 also failed (complains about the version being too new, as described above). But that's beside the point. It seems as though the installer script cannot find the compiled libxml2 as built by itself.

I am trying to locate the mkmf.log file but actually couldn't so far. Will add a comment if I do find it.

unframework commented 9 years ago

For what it's worth, the workaround from https://github.com/sparklemotion/nokogiri/issues/1231#issuecomment-83835884 helped, but I assume the installer might still have an issue in it.

Couldn't find the mkmf.log file anywhere in the gem directory (did find /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5 -name 'mkmf*').

zenspider commented 9 years ago

@unframework without providing a repro, I can't do anything with this as it works fine for me as-is.

The log won't be in gems, it'll be in extensions (same level): extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2/mkmf.log

clementcole commented 9 years ago

What exactly is nokogiri?? I'm so confused. Having the same issues. Started getting a similar error when I tried to run rails server on my localhost site.

rodnaph commented 9 years ago

@stuartherbert you are an absolute legend :)

jwoertink commented 9 years ago

I just had this issue installing 1.6.6.2 on 10.9.5. Solved with

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
jrand0m commented 9 years ago

had same issue with 1.6.6.2 on 10.10.4 (14E46) fixed with:

brew install libxml2
gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2
ando-takahiro commented 9 years ago

@jwoertink thanks :+1: you saved me :smiley:

ckristo commented 9 years ago

Experiencing the same issue here (while trying to install the latest version of the linkeddata gem that depends on nokogiri 1.6.6.2) ... Latest OSX (10.10.5), latest XCode (6.4 (6E35b)) and ruby 2.2.1p85 (installed via RVM). The mkmf.log file located under ~/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2 can be found here: http://pastebin.com/M64N5shd

This issue should be re-opened imo..

EDIT: installing with --use-system-libraries worked ..

airblair commented 9 years ago

I've just switched to Golang, am tired of fighting rails and ruby, etc.

On Aug 24, 2015, at 9:15 AM, Christoph Kindl notifications@github.com wrote:

Experiencing the same issue here (while trying to install the latest version of the linkeddata gem that depends on nokogiri 1.6.6.2) ... Latest OSX (10.10.5), latest XCode (6.4 (6E35b)) and ruby 2.2.1p85 (installed via RVM). The mkmf.log file located under ~/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2 :: see http://pastebin.com/M64N5shd

This issue should be re-opened imo..

— Reply to this email directly or view it on GitHub.

TheNathanBlack commented 9 years ago

Holy moly, after fighting this for an hour, thank you @sushilkv2004. That was the answer that got me through.

seekayel commented 9 years ago

FWIW: might be an issue with needing to agree to the XCode CLI ToS.

I hit this same installing Nokogiri 1.6.6.2, I am running 10.10.5 in diagnosing I saw this:

$ brew doctor

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool

I launched XCode, accepted the new terms and conditions, re-ran the bundle install and it worked, FTW!

jjb commented 8 years ago

Hi folks. FYI this problem is still present. The bug is that libxml2 is missing. But it's distributed with nokogiri itself, right? And the output shows that it is built successfully earlier in the process. @unframework also summarized the problem above.

@flavorjones @zenspider let me know if you need more info or if you feel our cases are outliers for some reason.


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/john/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20150925-87054-10gyqy.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.5.0/ports/libxml2/2.9.2... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/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... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.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... OK
Running 'install' for libxml2 2.9.2... OK
Activating libxml2 2.9.2 (from /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/x86_64-apple-darwin14.5.0/libxml2/2.9.2)...
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxslt-1.1.28
with the following patches applied:
    - 0001-Adding-doc-update-related-to-1.1.28.patch
    - 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
    - 0003-Initialize-pseudo-random-number-generator-with-curre.patch
    - 0004-EXSLT-function-str-replace-is-broken-as-is.patch
    - 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
    - 0007-Separate-function-for-predicate-matching-in-patterns.patch
    - 0008-Fix-direct-pattern-matching.patch
    - 0009-Fix-certain-patterns-with-predicates.patch
    - 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
    - 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
    - 0014-Fix-for-bug-436589.patch
    - 0015-Fix-mkdir-for-mingw.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
************************************************************************
Extracting libxslt-1.1.28.tar.gz into tmp/x86_64-apple-darwin14.5.0/ports/libxslt/1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0008-Fix-direct-pattern-matching.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0014-Fix-for-bug-436589.patch...
Running 'patch' for libxslt 1.1.28... OK
Running patch with /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxslt/0015-Fix-mkdir-for-mingw.patch...
Running 'patch' for libxslt 1.1.28... OK
Running 'configure' for libxslt 1.1.28... OK
Running 'compile' for libxslt 1.1.28... OK
Running 'install' for libxslt 1.1.28... OK
Activating libxslt 1.1.28 (from /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/x86_64-apple-darwin14.5.0/libxslt/1.1.28)...
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** 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/john/.rbenv/versions/2.2.3/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
    --with-xml2lib
    --without-xml2lib
    --with-libxml2lib
    --without-libxml2lib

extconf failed, exit code 1

Gem files will remain installed in /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/john/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/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.
bgohsman commented 8 years ago

I am also experiencing the exact issue described by @jjb when bundle install attempts to install Nokigiri 1.6.6.2. One developer in our group went through a process similar to what @enovajuan suggested, above, removing all ruby gems and starting from scratch, which worked. I will likely go through a similar process later this afternoon. Like @jjb, I can see that Nokigiri does, indeed, successfully install its own libxml2 package and then is unable to find it. I am able to successfully gem install by pointing it to the location. But bundle install will fail.

logicminds commented 8 years ago

After updating Xcode on 10.10 this week I had to accept the new Xcode license. I then ran brew update and then brew install libxml2 and everything seemed to work.

melhotiby commented 8 years ago

This worked for me

brew install libxml2
brew install libiconv
xcode-select --install
bundle config build.nokogiri --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/
gem install nokogiri
aurovrata commented 8 years ago

@jwoertink thanks, that worked for me too, 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

yosemite osx 10.10.5 xcode 7.1.1

renatodeleao commented 8 years ago

Had the same issue with 1.6.6.2, running El Capitan (10.11.1).

One does not simply install nokogiri without having errors :boom:

@jrand0m just saved my day.

dafeder commented 8 years ago

Yep @sushilkv2004 saved me too!

flavorjones commented 8 years ago

I'm going to lock this issue. If you're having problems, please open a new issue.

Context:

I just set up a brand new El Capitan machine, and I installed homebrew 0.9.5 and XCode comandline tools (as the installation tutorial suggests) and Nokogiri 1.6.6.4 installed cleanly the first time.

If you're having trouble installing Nokogiri, then yes, we need more information in order to reproduce what you're seeing.

At this point, I don't know what else to do to help Mac users, except ask "help us reproduce what you're seeing" over and over again. This is frustrating for you, and it's frustrating for us, but unfortunately it's the only way forward.

Help us reproduce what you're seeing, if you're having problems. Open a new issue with full information and logs and any additional information you have about how your machine got into its current state.