jules2689 / extended_bundler-errors

A `bundler` plugin that makes gem installation errors more actionable, educative, and all around easier to understand
MIT License
92 stars 5 forks source link

Nokogiri under macOS 10.15 Catalina #8

Open olivierlacan opened 4 years ago

olivierlacan commented 4 years ago
Installing nokogiri 1.10.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.7/ext/nokogiri
/Users/olivierlacan/.rbenv/versions/2.6.5/bin/ruby -I /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200107-60210-1nm6f5s.rb extconf.rb
checking if the C compiler accepts  -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... *** 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/olivierlacan/.rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME)
    --help
    --clean
/Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
    from /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/2.6.0/mkmf.rb:532:in `with_werror'
    from /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
    from extconf.rb:138:in `nokogiri_try_compile'
    from extconf.rb:162:in `block in add_cflags'
    from /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/2.6.0/mkmf.rb:643:in `with_cflags'
    from extconf.rb:161:in `add_cflags'
    from extconf.rb:416:in `<main>'

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

  /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nokogiri-1.10.7/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.7 for inspection.
Results logged to /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nokogiri-1.10.7/gem_make.out

An error occurred while installing nokogiri (1.10.7), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.7' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 6.0.2.1, which depends on
    actioncable was resolved to 6.0.2.1, which depends on
      actionpack was resolved to 6.0.2.1, which depends on
        actionview was resolved to 6.0.2.1, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri

====================
We weren't able to handle this error, but we noticed it is an issue with native extensions.
It is recommended to:

1. Find a string in the output that looks like it could be unique to this failure
2. Search Google to try and find a solution
3. Make an issue on http://github.com/jules2689/extended_bundler-errors
   with the output and any solutions you found
$ cat /Users/olivierlacan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nokogiri-1.10.7/mkmf.log
"clang -o conftest -I/Users/olivierlacan/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-darwin18 -I/Users/olivierlacan/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/olivierlacan/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/Users/olivierlacan/.rbenv/versions/2.6.5/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -pipe  -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2 conftest.c  -L. -L/Users/olivierlacan/.rbenv/versions/2.6.5/lib -L. -L/Users/olivierlacan/.rbenv/versions/2.6.5/lib  -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/llvm@4/4.0.1/lib/clang/4.0.1/lib     -lruby.2.6-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc    "
In file included from conftest.c:1:
In file included from /Users/olivierlacan/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby.h:33:
In file included from /Users/olivierlacan/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:29:
/Users/olivierlacan/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/defines.h:123:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */
jules2689 commented 4 years ago

❤️ Thank you! Did you find a solution? You have to install development tools first. makes it seem like it's the classic mac issue of "didya install xcode and install all the ~bloat~ fantastic tools it needs?"

olivierlacan commented 4 years ago

You're welcome 😃

I sadly already had Xcode (latest) and CLI Tools installed so I don't think this part of the error warrants that much attention. It's more the link to headers from the compiled Ruby 2.6.5 that I worry is broken somehow and I really don't know where Ruby looks for these header files to begin with, which might help debug this issue without the blunt force reinstalll Ruby that I wish people wouldn't have to do.

jules2689 commented 4 years ago

I think you should be able to just update xcode and the cli tools... I think!