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

Mac OS X: Failed to build gem native extension #1472

Closed sashazykov closed 7 years ago

sashazykov commented 8 years ago

Can not install nokogiri on a fresh installation of Mac OS X.

sw_vers
ProductName: Mac OS X ProductVersion: 10.11.5 BuildVersion: 15F34

gcc --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

clang --version Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

mkfile.log: https://gist.github.com/alexandrz/8487e67ec96e7870b31ed59baa6ae25e

Installing nokogiri 1.6.7.2 with native extensions

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

    current directory: /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/ext/nokogiri
/Users/sasha/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160525-18405-7eloxm.rb extconf.rb --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/
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.
Using mini_portile version 2.0.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv using --with-iconv-* flags... 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
    - 0003-Stop-parsing-on-entities-boundaries-errors.patch
    - 0004-Cleanup-conditional-section-error-handling.patch
    - 0005-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
    - 0006-Another-variation-of-overflow-in-Conditional-section.patch
    - 0007-Fix-an-error-in-previous-Conditional-section-patch.patch
    - 0008-CVE-2015-8035-Fix-XZ-compression-support-loop.patch
    - 0009-Updated-config.guess.patch
    - 0010-Fix-parsering-short-unclosed-comment-uninitialized-access.patch
    - 0011-Avoid-extra-processing-of-MarkupDecl-when-EOF.patch
    - 0012-Avoid-processing-entities-after-encoding-conversion-.patch
    - 0013-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch
    - 0014-CVE-2015-5312-Another-entity-expansion-issue.patch
    - 0015-Add-xmlHaltParser-to-stop-the-parser.patch
    - 0016-Detect-incoherency-on-GROW.patch
    - 0017-CVE-2015-7500-Fix-memory-access-error-due-to-incorre.patch
    - 0018-CVE-2015-8242-Buffer-overead-with-HTML-parser-in-pus.patch
    - 0019-Do-not-print-error-context-when-there-is-none.patch
    - 0020-xmlStopParser-reset-errNo.patch
    - 0021-Reuse-xmlHaltParser-where-it-makes-sense.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-darwin15.0.0/ports/libxml2/2.9.2... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0003-Stop-parsing-on-entities-boundaries-errors.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0004-Cleanup-conditional-section-error-handling.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0005-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0006-Another-variation-of-overflow-in-Conditional-section.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0007-Fix-an-error-in-previous-Conditional-section-patch.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0008-CVE-2015-8035-Fix-XZ-compression-support-loop.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0009-Updated-config.guess.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0010-Fix-parsering-short-unclosed-comment-uninitialized-access.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0011-Avoid-extra-processing-of-MarkupDecl-when-EOF.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0012-Avoid-processing-entities-after-encoding-conversion-.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0013-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0014-CVE-2015-5312-Another-entity-expansion-issue.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0015-Add-xmlHaltParser-to-stop-the-parser.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0016-Detect-incoherency-on-GROW.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0017-CVE-2015-7500-Fix-memory-access-error-due-to-incorre.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0018-CVE-2015-8242-Buffer-overead-with-HTML-parser-in-pus.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0019-Do-not-print-error-context-when-there-is-none.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0020-xmlStopParser-reset-errNo.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxml2/0021-Reuse-xmlHaltParser-where-it-makes-sense.patch... 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/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/ports/x86_64-apple-darwin15.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
    - 0016-Fix-for-type-confusion-in-preprocessing-attributes.patch
    - 0017-Updated-config.guess.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-darwin15.0.0/ports/libxslt/1.1.28... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0008-Fix-direct-pattern-matching.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0014-Fix-for-bug-436589.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0015-Fix-mkdir-for-mingw.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0016-Fix-for-type-confusion-in-preprocessing-attributes.patch... OK
Running git apply with /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/patches/libxslt/0017-Updated-config.guess.patch... 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/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2/ports/x86_64-apple-darwin15.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/sasha/.rvm/rubies/ruby-2.2.5/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

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/sasha/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/nokogiri-1.6.7.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/sasha/.rvm/gems/ruby-2.2.5/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /Users/sasha/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/nokogiri-1.6.7.2/gem_make.out
coderdave commented 8 years ago

as noted here: https://github.com/sparklemotion/nokogiri/issues/1445#issuecomment-219398565 you have to run xcode-select —install :(

flavorjones commented 7 years ago

As noted in the installation tutorial, as well.