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

Instalation fails on XUbuntu 13.04 with libqtwebkit-dev and libqt4-dev installed #557

Closed maciejkowalski closed 10 years ago

maciejkowalski commented 10 years ago

Just like in title

Stacktrace for installing capybara-webkit

Installing capybara-webkit (0.13.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/maciej/.rvm/rubies/ruby-1.9.3-p429-railsexpress/bin/ruby extconf.rb 
cd src/ && /usr/lib/x86_64-linux-gnu/qt4/bin/qmake /home/maciej/.rvm/gems/ruby-1.9.3-p429-railsexpress@joblark/gems/capybara-webkit-0.13.0/src/webkit_server.pro -spec /usr/share/qt4/mkspecs/linux-g++ -o Makefile.webkit_server
cd src/ && make -f Makefile.webkit_server 
make[1]: Entering directory `/home/maciej/.rvm/gems/ruby-1.9.3-p429-railsexpress@joblark/gems/capybara-webkit-0.13.0/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:42:17: error: incomplete type ‘QNetworkReply’ used in nested name specifier
WebPage.h:42:17: error: incomplete type ‘QNetworkReply’ used in nested name specifier
WebPage.h:42:45: error: template argument 1 is invalid
make[1]: *** [Authenticate.o] Error 1
make[1]: Leaving directory `/home/maciej/.rvm/gems/ruby-1.9.3-p429-railsexpress@joblark/gems/capybara-webkit-0.13.0/src'
make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2
Command 'make' failed

make
cd src/ && make -f Makefile.webkit_server 
make[1]: Entering directory `/home/maciej/.rvm/gems/ruby-1.9.3-p429-railsexpress@joblark/gems/capybara-webkit-0.13.0/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 Authenticate.o Authenticate.cpp
In file included from Authenticate.cpp:2:0:
WebPage.h:42:17: error: incomplete type ‘QNetworkReply’ used in nested name specifier
WebPage.h:42:17: error: incomplete type ‘QNetworkReply’ used in nested name specifier
WebPage.h:42:45: error: template argument 1 is invalid
make[1]: *** [Authenticate.o] Error 1
make[1]: Leaving directory `/home/maciej/.rvm/gems/ruby-1.9.3-p429-railsexpress@joblark/gems/capybara-webkit-0.13.0/src'
make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2

Gem files will remain installed in /home/maciej/.rvm/gems/ruby-1.9.3-p429-railsexpress@joblark/gems/capybara-webkit-0.13.0 for inspection.
Results logged to /home/maciej/.rvm/gems/ruby-1.9.3-p429-railsexpress@joblark/gems/capybara-webkit-0.13.0/./gem_make.out

An error occurred while installing capybara-webkit (0.13.0), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '0.13.0'` succeeds before bundling.

I have QT installed:

@maci ➜  ~ rvm:(ruby-2.0.0)  sudo apt-get install libqt4-dev libqtwebkit-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libqtwebkit-dev is already the newest version.
libqt4-dev is already the newest version.
The following packages were automatically installed and are no longer required:
  linux-headers-3.8.0-19 linux-headers-3.8.0-19-generic linux-headers-3.8.0-25 linux-headers-3.8.0-25-generic linux-image-3.8.0-19-generic linux-image-3.8.0-25-generic linux-image-extra-3.8.0-19-generic
  linux-image-extra-3.8.0-25-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
@maci ➜  ~ rvm:(ruby-2.0.0)  

QT version

@maci ➜  ~ rvm:(ruby-2.0.0)  qmake -v
QMake version 2.01a
Using Qt version 4.8.4 in /usr/lib/x86_64-linux-gnu
mhoran commented 10 years ago

It's possible that your installation has modified the QtWebKit headers in some way, which causes the QNetworkReply headers to not be included in WebPage.h. You could try modifying WebPage.h and adding #include <QNetworkReply> below the QtNetwork include.

maciejkowalski commented 10 years ago

there is no such thing:

@maci ➜  src rvm:(ruby-2.0.0)  head WebPage.h 
#ifndef _WEBPAGE_H
#define _WEBPAGE_H
#include <QtWebKit>

class WebPageManager;

class WebPage : public QWebPage {
  Q_OBJECT

  public:
@maci ➜  src rvm:(ruby-2.0.0)  

pwd

@maci ➜  src rvm:(ruby-2.0.0)  pwd
/home/maciej/.rvm/gems/ruby-1.9.3-p429-railsexpress@joblark/gems/capybara-webkit-0.13.0/src
@maci ➜  src rvm:(ruby-2.0.0)  

Thanks for the reply. :)

mhoran commented 10 years ago

@maciejkowalski, just below the #include <QtWebKit>, add #include <QNetworkReply>. It's possible that other headers have been modified by your distribution, in which case we'll have to figure that out as well. But if this works for you, we may just add the required include line on master.

mhoran commented 10 years ago

Actually, I just noticed that you're trying to install version 0.13.0, which is quite old. I'd recommend trying to upgrade to at least 0.14.2, or 1.0.0 if possible. It'll be difficult to provide support for 0.13.0 as we've moved far from that at this point.

maciejkowalski commented 10 years ago

I need to use 0.13.0 cuz our app is old, and upgrading to new capybara broke too many things We have that long-term goal in mind - upgrading capybara

I solved this issue by recompiling QT aka installing from source: http://qt-project.org/downloads

And then pointing this to bundler QMAKE=/usr/local/Trolltech/Qt-4.8.5/bin/qmake bundle