thoughtbot/capybara-webkit

Issues after upgrading to Qt5 on Yosemite: webkit_server failed to start and can't install capybara-webkit 1.6.0

monfresh opened this issue ยท 18 comments

Hi. I just upgraded to Qt5 per the instructions on the Wiki:

brew uninstall qt
brew install qt5
ln -s /usr/local/Cellar/qt5/5.4.2/bin/qmake /usr/local/bin/qmake

I had already upgraded to capybara-webkit 1.6.0 before upgrading to Qt5. When I saw the warning about Qt4, it prompted me to upgrade. Once I upgraded, I ran my specs, and now all specs with js: true are failing with webkit_server failed to start.

So then I tried uninstalling and reinstalling capybara-webkit. But now, I can no longer install capybara-webkit. I get the following error:

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

    /Users/moncefbelyamani/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150709-38307-w3r97t.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/moncefbelyamani/.rvm/rubies/ruby-2.2.2/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 '/usr/local/bin/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/lib' failed

extconf failed, exit code 1

Gem files will remain installed in /Users/moncefbelyamani/.rvm/gems/ruby-2.2.2@save-ferris/gems/capybara-webkit-1.6.0 for inspection.
Results logged to /Users/moncefbelyamani/.rvm/gems/ruby-2.2.2@save-ferris/extensions/x86_64-darwin-14/2.2.0/capybara-webkit-1.6.0/gem_make.out
An error occurred while installing capybara-webkit (1.6.0), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.6.0'` succeeds before bundling.

Note that it mentions Xcode not being set up properly, but I never installed Xcode on this machine. I only have the standalone command line tools via xcode select --install.

Everything was working perfectly until I upgraded. I noticed that the Wiki does not mention Yosemite. Could it be that there are additional steps required to use Qt5 on Yosemite?

If I uninstall qt5 and install qt, everything goes back to normal and I can bundle again to install capybara-webkit 1.6.0, and my tests pass again.

I believe this is a homebrew issue and not an capybara issue.

Your first issue above (run fails) is because capybara-webkit was linked against qt4, which you uninstalled.

The second issue (build fails) is because homebrew installs qt5 cellar only. So, to find the libs and includes, you either need to run brew link --force qt5 after installing qt5 or build the gem with:

PATH=$PATH:/usr/local/Cellar/qt5/5.4.2/bin \
LDFLAGS="-L/usr/local/Cellar/qt5/5.4.2/lib"  \
CPPFLAGS="-I/usr/local/Cellar/qt5/5.4.2/include" \
gem install capybara-webkit

Note that you leave out the linking of qmake if you include the PATH as above.

I had to:

  • uninstall qt4 and install qt5 with homebrew
  • brew link --force qt5
  • bundle uninstall capybara-webkit and then bundle install

Thanks @thebenedict and @cybercode. That still didn't solve my problem, and I realized it's probably because I don't have Xcode on this machine. On another machine that does have Xcode on it, I was able to install qt5 and capybara-webkit.

Unfortunately, having to install Xcode is a deal breaker for me, so I guess I'll use poltergeist instead.

mib32 commented

Installing Xcode was the only thing that solved the issue for me.

Hey! I am running into the same issue. I have xcode installed, however. I upgraded to qt5 on Yosemite. I am getting an identical error message when trying to install the capybara-webkit gem.

@durhamka you're seeing this error?

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

Are you using Homebrew? I'd be interested in the output of brew doctor.

OS X El Capitan: 10.11 (15A282a)
Xcode 7.0 and command-line tools installed

$ brew doctor
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
$ gem install capybara-webkit
Building native extensions.  This could take a while...
ERROR:  Error installing capybara-webkit:
    ERROR: Failed to build gem native extension.

    /Users/xxxx/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150918-99485-eejm5v.rb extconf.rb
*** 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/xxxx/.rvm/rubies/ruby-2.2.1/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 '/usr/bin/qmake-qt4 ' not available

extconf failed, exit code 1

Gem files will remain installed in /Users/xxxx/.rvm/gems/ruby-2.2.1/gems/capybara-webkit-1.7.0 for inspection.
Results logged to /Users/xxxx/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/capybara-webkit-1.7.0/gem_make.out

@rmangino can you paste the output of mkmf.log? Are you able to install any other gems with C extensions, such as Nokogiri?

I did a brew prune, deleted some extraneous headers that brew doctor was complaining about and now brew install capybara-webkit succeeds. I have no idea why.

Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
$ /usr/bin/xcodebuild
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

I have the same issue. The only solution which I found is to install XCode which I don't need (want). So I have to stick with qt4 for now :(.

I'm going to close this issue, as it seems like all of these reports are generally broken build tool installations on OS X.

If you're having trouble, I'd make sure:

  • brew doctor isn't complaining about anything.
  • You're able to install C extensions like pg and nokogiri.
  • You have build tools from xcode-select --install.
  • You've agreed to Apple's license agreement.

It seems like there may not be a way to accept the license agreement for Apple's build infrastructure without using Xcode.

This might be of help to people struggling with this problem: http://magnemg.tumblr.com/post/113251336220/how-to-solve-a-capybara-webkit-and-videojs

TL;DR:

Qt 5.4.1, as opposed to earlier versions, requires the full Xcode to be installed, to be able to build itself. It will probably remain a requirement for future Qt versions: https://wiki.qt.io/Qt_5.4.0_Known_Issues#QtWebEngine

Corollary: capybara-webkit does work with video on OSX Mavericks, but not with Qt 4.8.6, only with Qt 5, due to the updated Webkit implementation there. More here: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit

If someone figures out a way to get it working without having Xcode (>5 GB) and just using the "Command Line Tools for Xcode" instead (https://developer.apple.com/downloads/), then please let us know. I am currently considering experimenting with deleting Xcode now that I have already installed and built capybara-webkit and Qt 5, and see if everything still runs..

@redbar0n do you mind updating the Wiki page with what you've discovered so far?

https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit

Yeah, I already have, a while ago: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#video-playback-mp4-on-osx-requires-qt-5

I'll update it again if I discover all my tests run, and run green, even after deleting Xcode (now that I've built capybara-webkit and Qt 5).

I doubt this is a solution, but I've never worked with capybara-webkit or qt (honestly, haven't even looked up what it is), but I had the same issue; however, in my case, it's because no qt version was installed. I initially brew install(ed) qt and everything worked, but then I saw that the OP confirmed qt4 works, so I uninstalled it and installed qt5. My bundle was already installed so I removed capybara-webkit, bundle update(d) to remove it, and ran bundle install after adding back capybara-webkit. Everything worked fine. Is there something else I should try to see if qt5 is actually problematic?

EDIT: I assume this worked for me because native extensions were already built (?) using qt4. I'll create a new app and see if it still works and report back.

UPDATE: Yep, qt5 doesn't want to behave. Same error as the OP, except mine is simply Command 'qmake ' failed

I ran into this issue still today, and I was able to resolve it thanks to:

http://stackoverflow.com/questions/33728905/qt-creator-project-error-xcode-not-set-up-properly-you-may-need-to-confirm-t

The secret was:
(in your QtInstallDir, in clang_64/mkspecs/features/mac/default_pre.prf)

Step 2:

Replace:

isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))

With:

isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
bob commented

Got error as OP with Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild
But if I run /usr/bin/xcodebuild in project's directory then I got The directory ... does not contain an Xcode project
This solution helped https://stackoverflow.com/a/41063113.