Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have following errors when I try to install capybara-webkit ruby gem

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/s/.rvm/rubies/ruby-1.8.7-p371/bin/ruby extconf.rb 
    cd src/ && /usr/lib/x86_64-linux-gnu/qt4/bin/qmake /home/s/.rvm/gems/ruby-1.8.7- 
    p371@/gems/capybara-webkit-0.14.1/src/ -spec 
   /usr/share/qt4/mkspecs/linux-g++ -o Makefile.webkit_server
   cd src/ && make -f Makefile.webkit_server 
   make[1]: Entering directory `/home/s/.rvm/gems/ruby-1.8.7-p371@/gems/capybara-     webkit-0.14.1/src'

   g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB - DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. - I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui - I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I. -o EnableLogging.o EnableLogging.cpp
   g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -  DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. - I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui - I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I. -o Authenticate.o Authenticate.cpp
 In file included from Authenticate.cpp:2:0:
 WebPage.h:46:17: error: incomplete type ‘QNetworkReply’ used in nested name specifier   
 WebPage.h:46:17: error: incomplete type ‘QNetworkReply’ used in nested name specifier
 WebPage.h:46:45: error: template argument 1 is invalid
 make[1]: *** [Authenticate.o] Error 1
 make[1]: Leaving directory `/home/s/.rvm/gems/ruby-1.8.7-p371/gems/capybara-  webkit-0.14.1/src'
 make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2
 Command 'make' failed

I use Ubuntu 13.04 and I have installed libqt4-dev and g++. Does anyone know how to fix it? I installed it correctly on Ubuntu 12.10.

share|improve this question

Seems to be a popular issue...

Had this problem myself and fought with it for a week or so. Seems to be working now though! Problem is I can't narrow it down to what I did. Here's a list of things that might of helped fix it:

Install missing packages:

sudo apt-get install libqt4-dev libqtwebkit-dev build-essential

If the packages exist already purge and then install

sudo apt-get purge libqt4-dev libqtwebkit-dev 

Reinstall ruby

rvm reinstall 1.9.3

sudo apt-get update && sudo apt-get upgrade

I think re-installing RVM was what did it for me. It had become cluttered over time with all the different rails projects and personal hacks.

share|improve this answer
Splendid! Deleting Gemfile.lock resolved it for me. Re-creating the gemset did nothing, nor did reinstalling the Qt packages. – Jonah Aug 23 '13 at 1:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.