thoughtbot / capybara-webkit

A Capybara driver for headless WebKit to test JavaScript web apps
https://thoughtbot.com/open-source
MIT License
1.97k stars 428 forks source link

High Sierra (Mac OS 10.13.2): Failed to build gem native extension. #1052

Closed etagwerker closed 6 years ago

etagwerker commented 6 years ago

Hello,

I'm currently having a problem installing capybara-webkit - I've tried with the latest version in master and with version 1.14.0 and this is the error I get:

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

    current directory: /Users/etagwerker/.rvm/gems/ruby-2.4.3/bundler/gems/capybara-webkit-c46d2e90b530
/Users/etagwerker/.rvm/rubies/ruby-2.4.3/bin/ruby -r ./siteconf20180115-76281-1d0vz7d.rb extconf.rb
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
*** 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=/Users/etagwerker/.rvm/rubies/ruby-2.4.3/bin/$(RUBY_BASE_NAME)
    --with-gl-dir
    --without-gl-dir
    --with-gl-include
    --without-gl-include=${gl-dir}/include
    --with-gl-lib
    --without-gl-lib=${gl-dir}/lib
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
Command 'qmake LIBS\ \+\=\ -L/usr/local/opt/libyaml/lib\ -L/usr/local/opt/readline/lib\ -L/usr/local/opt/libksba/lib\ -L/usr/local/opt/openssl@1.1/lib'
failed

extconf failed, exit code 1

Gem files will remain installed in /Users/etagwerker/.rvm/gems/ruby-2.4.3/bundler/gems/capybara-webkit-c46d2e90b530 for inspection.
Results logged to /Users/etagwerker/.rvm/gems/ruby-2.4.3/bundler/gems/extensions/x86_64-darwin-17/2.4.0/capybara-webkit-c46d2e90b530/gem_make.out

An error occurred while installing capybara-webkit (1.14.0), and Bundler cannot continue.

In Gemfile:
  capybara-webkit

I followed these instructions: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#macos-sierra-1012-el-capitan-1011-and-yosemite-1010

This is my qt version:

which qmake
/usr/local/opt/qt@5.5/bin/qmake

When I run the instruction that is failing, this is what I get:

qmake LIBS\ \+\=\ -L/usr/local/opt/libyaml/lib\ -L/usr/local/opt/readline/lib\ -L/usr/local/opt/libksba/lib\ -L/usr/local/opt/openssl@1.1/lib
Usage: qmake [mode] [options] [files]

QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project

Mode:
  -project       Put qmake into project file generation mode
                 In this mode qmake interprets files as files to
                 be built,
                 defaults to *; *; *; *.ts; *.xlf; *.qrc
                 Note: The created .pro file probably will
                 need to be edited. For example add the QT variable to
                 specify what modules are required.
  -makefile      Put qmake into makefile generation mode (default)
                 In this mode qmake interprets files as project files to
                 be processed, if skipped qmake will try to find a project
                 file in your current working directory

Warnings Options:
  -Wnone         Turn off all warnings; specific ones may be re-enabled by
                 later -W options
  -Wall          Turn on all warnings
  -Wparser       Turn on parser warnings
  -Wlogic        Turn on logic warnings (on by default)
  -Wdeprecated   Turn on deprecation warnings (on by default)

Options:
   * You can place any variable assignment in options and it will be     *
   * processed as if it was in [files]. These assignments will be parsed *
   * before [files].                                                     *
  -o file        Write output to file
  -d             Increase debug level
  -t templ       Overrides TEMPLATE as templ
  -tp prefix     Overrides TEMPLATE so that prefix is prefixed into the value
  -help          This help
  -v             Version information
  -after         All variable assignments after this will be
                 parsed after [files]
  -norecursive   Don't do a recursive search
  -recursive     Do a recursive search
  -set <prop> <value> Set persistent property
  -unset <prop>  Unset persistent property
  -query <prop>  Query persistent property. Show all if <prop> is empty.
  -cache file    Use file as cache           [makefile mode only]
  -spec spec     Use spec as QMAKESPEC       [makefile mode only]
  -nocache       Don't use a cache file      [makefile mode only]
  -nodepend      Don't generate dependencies [makefile mode only]
  -nomoc         Don't generate moc targets  [makefile mode only]
  -nopwd         Don't look for files in pwd [project mode only]

Do you know what could be wrong with my setup?

Thank you!

twalpole commented 6 years ago

Have you done as the errors suggests?

Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild

etagwerker commented 6 years ago

@twalpole Good question. Yes, I just tried and this is what I got:

/usr/bin/xcodebuild
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

I guess that the problem there is that I first installed command line tools, and after that I installed Xcode (9.2) - It was one of my attempts to do a workaround to this problem.

After googling that Xcode error message, I found this comment: https://github.com/nodejs/node-gyp/issues/569#issuecomment-94917337

After running sudo xcode-select -s /Applications/Xcode.app/Contents/Developer and trying again, I see that gem install is finally working!

Thank you!