0

I couldn't bundle since there was an error occurred while installing capybara-webkit (1.11.1). So I tried gem install capybara-webkit -v '1.11.1', but it returned en error: Failed to build gem native extension. I'm not even sure what does it mean.

The entire output would be:

Building native extensions.  This could take a while...
ERROR:  Error installing capybara-webkit:
    ERROR: Failed to build gem native extension.

    current directory: ...

*** 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=...
    --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 ' ' not available

extconf failed, exit code 1

Gem files will remain installed in .../capybara-webkit-1.11.1 for inspection.
Results logged to .../capybara-webkit-1.11.1/gem_make.out

Does anyone know how to handle this issue? Thank you in advance!

e.b
  • 163
  • 2
  • 10
  • Possible duplicate of [unable to install capybara-webkit on OS X El Capitan](https://stackoverflow.com/questions/34015386/unable-to-install-capybara-webkit-on-os-x-el-capitan) – fabdurso Jun 19 '17 at 14:31
  • Possible duplicate of [ERROR: Error installing capybara-webkit:](https://stackoverflow.com/questions/11354656/error-error-installing-capybara-webkit) – vich Jun 22 '17 at 19:08

2 Answers2

0

Try this:

brew install qt@5.5
brew link --force qt@5.5
gem install capybara-webkit

You can further check here: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#macos-sierra-1012-el-capitan-1011-and-yosemite-1010

raghu
  • 260
  • 2
  • 16
  • @ raghu. I did exactly that, but still the same result. I have tried to uninstall qt and install the latest version (5.9.0), but still, the same results – e.b Jun 20 '17 at 02:09
  • I tried the same solution that @Thomas suggested and it took me about 8hrs to install. Also, glad to see that you got it working. – raghu Jun 21 '17 at 08:20
0

The answer posted by @raghu will work with Qt5.5 which is the last version officially supported by the developers of capybara-webkit. Another option is to make homebrew install qt-webkit with the current version of qt and then build capybara-webkit against that. Start by uninstalling qt from homebrew if you've already installed it (brew uninstall qt), then

brew install qt --with-qtwebkit

and go do something else for a while as it compiles from source. Once it's finished try installing the capybara-webkit gem again.

Thomas Walpole
  • 48,548
  • 5
  • 64
  • 78
  • It still doesn't work :( I tried it. It returned the output: `Updating Homebrew... ==> Auto-updated Homebrew! Updated 2 taps (caskroom/cask, homebrew/core). ==> Updated Formulae dieharder flowgrind gauge gnuradio gsl gtksourceview3 oscats translate-toolkit Warning: qt 5.9.0 is already installed` I still get the same error: `Failed to build gem native extension.` for running: `gem install capybara-webkit -v '1.11.1'` – e.b Jun 20 '17 at 02:00
  • @ Thomas Walpole. Yes. I have uninstall it once, then reinstall it. Still, doesn't work – e.b Jun 20 '17 at 02:04
  • @e.b. It shouldn't say "Warning: qt 5.9.0 is already installed" when you go to install if you had actually uninstalled it (and it will probably take an hour or so to build/install if you did it properly). – Thomas Walpole Jun 20 '17 at 02:05
  • @e.b If you've installed it correctly when you do `brew info qt` it should show something like - /usr/local/Cellar/qt/5.9.0 (9,124 files, 321.1MB) Built from source on 2017-06-19 at 17:59:45 with: --with-qtwebkit - The "Built from source" and "with: --with-qtwebkit" are the important parts. Also look at the end of the `mkmf.log` file and `.../capybara-webkit-1.11.1/gem_make.out` for the cause of the errors – Thomas Walpole Jun 20 '17 at 02:09
  • @ Thomas Walpole. I did it. still, can't install the gem. I got: `qt: stable 5.9.0 (bottled), HEAD [keg-only] Cross-platform application and UI framework https://www.qt.io/ /usr/local/Cellar/qt/4.8.7_2 (2,815 files, 113.0MB) Poured from bottle on 2016-12-09 at 12:04:50 /usr/local/Cellar/qt/5.8.0_1 (8,667 files, 247.9MB) Poured from bottle on 2017-02-08 at 10:37:45` – e.b Jun 20 '17 at 02:15
  • @e.b. Which isn't correct -- the "Poured from bottle" shows that it didn't build from source - and it doesn't have qtwebkit included. You need to uninstall all the qts and then install with the command I showed in the answer -- if it doesn't take an hour or so to install (because it needs to build from source) it's not right – Thomas Walpole Jun 20 '17 at 03:02
  • @ Thomas Walpole. I have succeeded to uninstall all the `qts` and run your command. Now, it's stuck on `make` more than 3 hours already. Do you have any idea what is wrong? – e.b Jun 20 '17 at 07:46
  • @e.b probably nothing, compile time is dependent on your hardware – Thomas Walpole Jun 20 '17 at 14:29
  • @ Thomas Walpole. The command `brew install qt --with-qtwebkit` has finally finished. Still get the same error for `gem install capybara-webkit -v '1.11.1'` :( – e.b Jun 21 '17 at 01:58
  • @e.b Ok - so assuming `brew info qt` now provides the correct info, what errors are you seeing in the `mkmf.log` file and `.../capybara-webkit-1.11.1/gem_make.out` .. You also may need to do `brew link qt` – Thomas Walpole Jun 21 '17 at 02:02
  • @ Thomas Walpole. Where is the `mkmf.log` file located? I tried `find ~/.rbenv -name mkmf.log | grep capybara-webkit` but found nothing – e.b Jun 21 '17 at 02:54
  • `brew info qt` provides the correct info. `which qmake` didn't returned any path. after I did `brew link --force qt`, `which qmake` did return a path. After that, I succeeded to run `gem install capybara-webkit -v '1.11.1'` and `bundle `properly! @ Thomas Walpole, Thank you very much! – e.b Jun 21 '17 at 03:41