Skip to content
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

Nokogiri 1.8.5, macOS High Sierra and brew's binutils #1812

Closed
gpakosz opened this issue Nov 2, 2018 · 6 comments
Closed

Nokogiri 1.8.5, macOS High Sierra and brew's binutils #1812

gpakosz opened this issue Nov 2, 2018 · 6 comments
Milestone

Comments

@gpakosz
Copy link
Contributor

gpakosz commented Nov 2, 2018

Hello, I'm using brew's Ruby:

$ brew info ruby
ruby: stable 2.5.3 (bottled), HEAD
Powerful, clean, object-oriented scripting language
https://www.ruby-lang.org/
/usr/local/Cellar/ruby/2.5.3 (16,228 files, 27.6MB) *
  Poured from bottle on 2018-11-02 at 09:13:02
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ruby.rb
==> Dependencies
Build: pkg-config ✔
Required: libyaml ✔, openssl ✔, readline ✔

And I tried to install Nokogiri with gem install nokogiri which gave me:

$ gem install nokogiri
Building native extensions. This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20181102-6734-16ue8my.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.
Using mini_portile version 2.3.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv using --with-opt-* flags... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.8
with the following patches applied:
        - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
        - 0002-Fix-nullptr-deref-with-XPath-logic-ops.patch
        - 0003-Fix-infinite-loop-in-LZMA-decompression.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.8.tar.gz into tmp/x86_64-apple-darwin17.7.0/ports/libxml2/2.9.8... OK
Running git apply with /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK
Running git apply with /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/patches/libxml2/0002-Fix-nullptr-deref-with-XPath-logic-ops.patch... OK
Running git apply with /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/patches/libxml2/0003-Fix-infinite-loop-in-LZMA-decompression.patch... OK
Running 'configure' for libxml2 2.9.8... OK
Running 'compile' for libxml2 2.9.8... ERROR, review '/usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri/tmp/x86_64-apple-darwin17.7.0/ports/libxml2/2.9.8/compile.log' to see what happened. Last lines are:
========================================================================
      _parseAndPrintFile in xmllint.o
  "_xmlXPathEval", referenced from:
      _doXPathQuery in xmllint.o
  "_xmlXPathFreeContext", referenced from:
      _doXPathQuery in xmllint.o
  "_xmlXPathFreeObject", referenced from:
      _doXPathQuery in xmllint.o
  "_xmlXPathIsInf", referenced from:
      _doXPathDump in xmllint.o
  "_xmlXPathIsNaN", referenced from:
      _doXPathDump in xmllint.o
  "_xmlXPathNewContext", referenced from:
      _doXPathQuery in xmllint.o
  "_xmlXPathOrderDocElems", referenced from:
      _parseAndPrintFile in xmllint.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [xmllint] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** 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
        --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/local/Cellar/ruby/2.5.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
/usr/local/lib/ruby/gems/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:402:in `block in execute': Failed to complete compile task (RuntimeError)
        from /usr/local/lib/ruby/gems/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in `chdir'
        from /usr/local/lib/ruby/gems/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in `execute'
        from /usr/local/lib/ruby/gems/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:115:in `compile'
        from /usr/local/lib/ruby/gems/2.5.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:154:in `cook'
        from extconf.rb:365:in `block (2 levels) in process_recipe'
        from extconf.rb:257:in `block in chdir_for_build'
        from extconf.rb:256:in `chdir'
        from extconf.rb:256:in `chdir_for_build'
        from extconf.rb:364:in `block in process_recipe'
        from extconf.rb:262:in `tap'
        from extconf.rb:262:in `process_recipe'
        from extconf.rb:551:in `<main>'

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

  /usr/local/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-17/2.5.0/nokogiri-1.8.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-17/2.5.0/nokogiri-1.8.5/gem_make.out

Here is the content of /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri/tmp/x86_64-apple-darwin17.7.0/ports/libxml2/2.9.8/compile.log:

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in include
Making all in libxml
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `all-am'.
Making all in .
  CC       SAX.lo
  CC       entities.lo
  CC       encoding.lo
encoding.c:500:26: warning: cast from 'const unsigned char *' to 'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
    unsigned short* in = (unsigned short*) inb;
                         ^~~~~~~~~~~~~~~~~~~~~
encoding.c:582:27: warning: cast from 'unsigned char *' to 'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
    unsigned short* out = (unsigned short*) outb;
                          ^~~~~~~~~~~~~~~~~~~~~~
encoding.c:738:26: warning: cast from 'const unsigned char *' to 'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
    unsigned short* in = (unsigned short*) inb;
                         ^~~~~~~~~~~~~~~~~~~~~
encoding.c:824:27: warning: cast from 'unsigned char *' to 'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
    unsigned short* out = (unsigned short*) outb;
                          ^~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
  CC       error.lo
  CC       parserInternals.lo
  CC       parser.lo
  CC       tree.lo
  CC       hash.lo
  CC       list.lo
  CC       xmlIO.lo
  CC       xmlmemory.lo
  CC       uri.lo
  CC       valid.lo
  CC       xlink.lo
  CC       HTMLparser.lo
  CC       HTMLtree.lo
  CC       debugXML.lo
  CC       xpath.lo
  CC       xpointer.lo
  CC       xinclude.lo
  CC       nanohttp.lo
  CC       nanoftp.lo
  CC       catalog.lo
  CC       globals.lo
  CC       threads.lo
  CC       c14n.lo
  CC       xmlstring.lo
  CC       buf.lo
  CC       xmlregexp.lo
  CC       xmlschemas.lo
  CC       xmlschemastypes.lo
  CC       xmlunicode.lo
  CC       xmlreader.lo
  CC       relaxng.lo
  CC       dict.lo
  CC       SAX2.lo
  CC       xmlwriter.lo
  CC       legacy.lo
  CC       chvalid.lo
  CC       pattern.lo
  CC       xmlsave.lo
  CC       xmlmodule.lo
  CC       schematron.lo
  CC       xzlib.lo
  CCLD     libxml2.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       testdso.lo
  CCLD     testdso.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       xmllint.o
  CCLD     xmllint
ld: warning: ignoring file ./.libs/libxml2.a, file was built for archive which is not the architecture being linked (x86_64): ./.libs/libxml2.a
Undefined symbols for architecture x86_64:
  "___xmlDoValidityCheckingDefaultValue", referenced from:
      _main in xmllint.o
  "___xmlGenericError", referenced from:
      _main in xmllint.o
      _streamFile in xmllint.o
      _parseAndPrintFile in xmllint.o
      _xmlHTMLError in xmllint.o
      _xmlHTMLWarning in xmllint.o
      _xmlHTMLValidityError in xmllint.o
      _xmlHTMLValidityWarning in xmllint.o
      ...
  "___xmlGenericErrorContext", referenced from:
      _main in xmllint.o
      _streamFile in xmllint.o
      _parseAndPrintFile in xmllint.o
      _xmlHTMLError in xmllint.o
      _xmlHTMLWarning in xmllint.o
      _xmlHTMLValidityError in xmllint.o
      _xmlHTMLValidityWarning in xmllint.o
      ...
  "___xmlGetWarningsDefaultValue", referenced from:
      _main in xmllint.o
  "___xmlLoadExtDtdDefaultValue", referenced from:
      _main in xmllint.o
  "___xmlParserDebugEntities", referenced from:
      _main in xmllint.o
  "___xmlParserVersion", referenced from:
      _showVersion in xmllint.o
  "___xmlTreeIndentString", referenced from:
      _main in xmllint.o
  "_htmlCreatePushParserCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_htmlDocDump", referenced from:
      _parseAndPrintFile in xmllint.o
  "_htmlFreeParserCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_htmlParseChunk", referenced from:
      _parseAndPrintFile in xmllint.o
  "_htmlReadFile", referenced from:
      _parseAndPrintFile in xmllint.o
  "_htmlReadMemory", referenced from:
      _parseAndPrintFile in xmllint.o
  "_htmlSaveFile", referenced from:
      _parseAndPrintFile in xmllint.o
  "_htmlSaveFileFormat", referenced from:
      _parseAndPrintFile in xmllint.o
  "_inputPush", referenced from:
      _testSAX in xmllint.o
  "_xmlAddEncodingAlias", referenced from:
      _main in xmllint.o
  "_xmlC14NDocDumpMemory", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlCheckVersion", referenced from:
      _main in xmllint.o
  "_xmlCleanupParser", referenced from:
      _main in xmllint.o
  "_xmlCopyDoc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlCreatePushParserCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlCtxtReadFile", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlCtxtReadIO", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlCtxtReadMemory", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlCtxtUseOptions", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlDebugDumpDocument", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlDebugDumpEntities", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlDeregisterNodeDefault", referenced from:
      _main in xmllint.o
  "_xmlDocDump", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlDocDumpFormatMemory", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlDocDumpFormatMemoryEnc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlDocDumpMemory", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlDocDumpMemoryEnc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlDocGetRootElement", referenced from:
      _walkDoc in xmllint.o
  "_xmlDocSetRootElement", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlEncodeEntitiesReentrant", referenced from:
      _xmlHTMLEncodeSend in xmllint.o
  "_xmlFree", referenced from:
      _myStrdupFunc in xmllint.o
      _xmllintExternalEntityLoader in xmllint.o
      _parseAndPrintFile in xmllint.o
      _processNode in xmllint.o
      _xmlHTMLEncodeSend in xmllint.o
  "_xmlFreeDoc", referenced from:
      _testSAX in xmllint.o
      _parseAndPrintFile in xmllint.o
  "_xmlFreeDtd", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlFreeEnumeration", referenced from:
      _attributeDeclDebug in xmllint.o
  "_xmlFreeParserCtxt", referenced from:
      _main in xmllint.o
      _testSAX in xmllint.o
      _parseAndPrintFile in xmllint.o
  "_xmlFreeParserInputBuffer", referenced from:
      _streamFile in xmllint.o
      _testSAX in xmllint.o
  "_xmlFreePattern", referenced from:
      _main in xmllint.o
  "_xmlFreeStreamCtxt", referenced from:
      _streamFile in xmllint.o
      _processNode in xmllint.o
      _walkDoc in xmllint.o
  "_xmlFreeTextReader", referenced from:
      _streamFile in xmllint.o
      _walkDoc in xmllint.o
  "_xmlFreeValidCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlGetExternalEntityLoader", referenced from:
      _main in xmllint.o
  "_xmlGetIntSubset", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlGetNodePath", referenced from:
      _processNode in xmllint.o
  "_xmlHasFeature", referenced from:
      _showVersion in xmllint.o
  "_xmlKeepBlanksDefault", referenced from:
      _main in xmllint.o
  "_xmlLineNumbersDefault", referenced from:
      _main in xmllint.o
  "_xmlLoadCatalogs", referenced from:
      _main in xmllint.o
  "_xmlMemFree", referenced from:
      _myFreeFunc in xmllint.o
      _myMallocFunc in xmllint.o
      _myReallocFunc in xmllint.o
  "_xmlMemMalloc", referenced from:
      _myMallocFunc in xmllint.o
  "_xmlMemRealloc", referenced from:
      _myReallocFunc in xmllint.o
  "_xmlMemSetup", referenced from:
      _main in xmllint.o
  "_xmlMemUsed", referenced from:
      _myMallocFunc in xmllint.o
      _myReallocFunc in xmllint.o
      _myStrdupFunc in xmllint.o
  "_xmlMemoryDump", referenced from:
      _main in xmllint.o
  "_xmlMemoryStrdup", referenced from:
      _myStrdupFunc in xmllint.o
  "_xmlNewDoc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlNewDocNode", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlNewIOInputStream", referenced from:
      _testSAX in xmllint.o
  "_xmlNewParserCtxt", referenced from:
      _main in xmllint.o
      _testSAX in xmllint.o
      _parseAndPrintFile in xmllint.o
  "_xmlNewValidCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlNoNetExternalEntityLoader", referenced from:
      _main in xmllint.o
  "_xmlNodeSetContent", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlParseChunk", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlParseDTD", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlParseDocument", referenced from:
      _testSAX in xmllint.o
  "_xmlParseFile", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlParserInputBufferCreateFilename", referenced from:
      _testSAX in xmllint.o
  "_xmlPatternGetStreamCtxt", referenced from:
      _streamFile in xmllint.o
      _walkDoc in xmllint.o
  "_xmlPatternMatch", referenced from:
      _processNode in xmllint.o
  "_xmlPatterncompile", referenced from:
      _main in xmllint.o
      _streamFile in xmllint.o
      _walkDoc in xmllint.o
  "_xmlPedanticParserDefault", referenced from:
      _main in xmllint.o
  "_xmlReadFd", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlReadFile", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlReadIO", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlReadMemory", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlReaderForFile", referenced from:
      _streamFile in xmllint.o
  "_xmlReaderForMemory", referenced from:
      _streamFile in xmllint.o
  "_xmlReaderWalker", referenced from:
      _walkDoc in xmllint.o
  "_xmlRegisterNodeDefault", referenced from:
      _main in xmllint.o
  "_xmlRelaxNGCleanupTypes", referenced from:
      _main in xmllint.o
  "_xmlRelaxNGFree", referenced from:
      _main in xmllint.o
  "_xmlRelaxNGFreeParserCtxt", referenced from:
      _main in xmllint.o
  "_xmlRelaxNGFreeValidCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlRelaxNGNewParserCtxt", referenced from:
      _main in xmllint.o
  "_xmlRelaxNGNewValidCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlRelaxNGParse", referenced from:
      _main in xmllint.o
  "_xmlRelaxNGSetParserErrors", referenced from:
      _main in xmllint.o
  "_xmlRelaxNGSetValidErrors", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlRelaxNGValidateDoc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSAXDefaultVersion", referenced from:
      _main in xmllint.o
  "_xmlSaveClose", referenced from:
      _parseAndPrintFile in xmllint.o
      _doXPathDump in xmllint.o
  "_xmlSaveDoc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSaveFile", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSaveFileEnc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSaveFormatFile", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSaveFormatFileEnc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSaveToFd", referenced from:
      _parseAndPrintFile in xmllint.o
      _doXPathDump in xmllint.o
  "_xmlSaveToFilename", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSaveTree", referenced from:
      _doXPathDump in xmllint.o
  "_xmlSchemaFree", referenced from:
      _main in xmllint.o
  "_xmlSchemaFreeParserCtxt", referenced from:
      _main in xmllint.o
  "_xmlSchemaFreeValidCtxt", referenced from:
      _testSAX in xmllint.o
      _parseAndPrintFile in xmllint.o
  "_xmlSchemaNewParserCtxt", referenced from:
      _main in xmllint.o
  "_xmlSchemaNewValidCtxt", referenced from:
      _testSAX in xmllint.o
      _parseAndPrintFile in xmllint.o
  "_xmlSchemaParse", referenced from:
      _main in xmllint.o
  "_xmlSchemaSetParserErrors", referenced from:
      _main in xmllint.o
  "_xmlSchemaSetValidErrors", referenced from:
      _testSAX in xmllint.o
      _parseAndPrintFile in xmllint.o
  "_xmlSchemaValidateDoc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSchemaValidateSetFilename", referenced from:
      _testSAX in xmllint.o
  "_xmlSchemaValidateStream", referenced from:
      _testSAX in xmllint.o
  "_xmlSchematronFree", referenced from:
      _main in xmllint.o
  "_xmlSchematronFreeParserCtxt", referenced from:
      _main in xmllint.o
  "_xmlSchematronFreeValidCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSchematronNewParserCtxt", referenced from:
      _main in xmllint.o
  "_xmlSchematronNewValidCtxt", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSchematronParse", referenced from:
      _main in xmllint.o
  "_xmlSchematronValidateDoc", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlSetCompressMode", referenced from:
      _main in xmllint.o
  "_xmlSetExternalEntityLoader", referenced from:
      _main in xmllint.o
  "_xmlShell", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlStrcat", referenced from:
      _xmllintExternalEntityLoader in xmllint.o
  "_xmlStrdup", referenced from:
      _xmllintExternalEntityLoader in xmllint.o
  "_xmlStreamPop", referenced from:
      _processNode in xmllint.o
  "_xmlStreamPush", referenced from:
      _streamFile in xmllint.o
      _processNode in xmllint.o
      _walkDoc in xmllint.o
  "_xmlStrndup", referenced from:
      _parsePath in xmllint.o
  "_xmlSubstituteEntitiesDefault", referenced from:
      _main in xmllint.o
  "_xmlTextReaderConstLocalName", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderConstName", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderConstNamespaceUri", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderConstValue", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderCurrentNode", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderDepth", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderHasValue", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderIsEmptyElement", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderIsValid", referenced from:
      _streamFile in xmllint.o
  "_xmlTextReaderNodeType", referenced from:
      _processNode in xmllint.o
  "_xmlTextReaderRead", referenced from:
      _streamFile in xmllint.o
      _walkDoc in xmllint.o
  "_xmlTextReaderRelaxNGValidate", referenced from:
      _streamFile in xmllint.o
  "_xmlTextReaderSchemaValidate", referenced from:
      _streamFile in xmllint.o
  "_xmlTextReaderSetParserProp", referenced from:
      _streamFile in xmllint.o
  "_xmlUnlinkNode", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlValidGetValidElements", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlValidateDocument", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlValidateDtd", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlXIncludeProcessFlags", referenced from:
      _parseAndPrintFile in xmllint.o
  "_xmlXPathEval", referenced from:
      _doXPathQuery in xmllint.o
  "_xmlXPathFreeContext", referenced from:
      _doXPathQuery in xmllint.o
  "_xmlXPathFreeObject", referenced from:
      _doXPathQuery in xmllint.o
  "_xmlXPathIsInf", referenced from:
      _doXPathDump in xmllint.o
  "_xmlXPathIsNaN", referenced from:
      _doXPathDump in xmllint.o
  "_xmlXPathNewContext", referenced from:
      _doXPathQuery in xmllint.o
  "_xmlXPathOrderDocElems", referenced from:
      _parseAndPrintFile in xmllint.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [xmllint] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

After some troubleshooting, I realized I had binutils installed with Homebrew and also linked for some reason. Which replaces sytem's ar by GNU ar.
Nowadays when you try to $ brew link binutils, brew bails out but maybe it was previously allowed:

$ brew link binutils
If you need to have binutils first in your PATH run:
  echo 'export PATH="/usr/local/opt/binutils/bin:$PATH"' >> ~/.bash_profile

For compilers to find binutils you may need to set:
  export LDFLAGS="-L/usr/local/opt/binutils/lib"
  export CPPFLAGS="-I/usr/local/opt/binutils/include"

So the solution is really to brew unlink binutils and make sure you don't have /usr/local/opt/binutils/bin in your PATH before doing gem install nokogiri.

A solution I found is to pass RANLIB=/usr/bin/ranlib to configure, when building for Darwin.

@flavorjones
Copy link
Member

/cc @zenspider

Would anyone care to summarize the above and submit a PR to https://github.com/sparklemotion/nokogiri.org-tutorials/blob/master/content/installing_nokogiri.md ?

@flavorjones
Copy link
Member

Or submit a PR to Nokogiri? @gpakosz I see you have a fork with a commit on it for this.

@gpakosz
Copy link
Contributor Author

gpakosz commented Nov 2, 2018

@flavorjones I don't believe this should be solved by entries in the documentation.

I submitted PR #1813 as you noticed and I just edited the description to explain why I'm suggesting the change.

@gpakosz gpakosz changed the title Nokogiri 1.8.5, macOS High Sierra and brew's Ruby Nokogiri 1.8.5, macOS High Sierra and brew's binutils Nov 4, 2018
@CaledoniaProject
Copy link

Wow, this saved my day! Nearly all my homebrew packages failed to compile due to this, e.g mysql@5.5.

Confirms that brew unlinks binutils work for both gem and brew.

flavorjones added a commit that referenced this issue Dec 1, 2018
On Darwin, ignore anything but system's ranlib. Fixes #1812
@flavorjones flavorjones added this to the next milestone Dec 1, 2018
@flavorjones
Copy link
Member

I've merged #1813 which will be in the next release, hopefully in the next few days.

@gpakosz
Copy link
Contributor Author

gpakosz commented Dec 1, 2018

Thanks @flavorjones 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants