问题
This is really a tough one for me. I'm trying to migrate over to Mountain Lion but I get the following when trying to install capybara-webkit.
The initial error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/martinb/.rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
cd src/ && /usr/bin/qmake /Users/martinb/.rvm/gems/ruby-1.9.3-p374/gems/capybara-webkit-0.14.1/src/webkit_server.pro -spec /usr/local/Qt4.7/mkspecs/macx-g++ -o Makefile.webkit_server
cd src/ && make -f Makefile.webkit_server
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o EnableLogging.o EnableLogging.cpp
In file included from /Library/Frameworks/QtCore.framework/Headers/qnamespace.h:45,
from /Library/Frameworks/QtCore.framework/Headers/qobjectdefs.h:45,
from /Library/Frameworks/QtCore.framework/Versions/4/Headers/qobject.h:47,
from /Library/Frameworks/QtCore.framework/Versions/4/Headers/QObject:1,
from SocketCommand.h:4,
from EnableLogging.h:1,
from EnableLogging.cpp:1:
/Library/Frameworks/QtCore.framework/Headers/qglobal.h:320:6: warning: #warning "This version of Mac OS X is unsupported"
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Authenticate.o Authenticate.cpp
In file included from /Library/Frameworks/QtCore.framework/Headers/qnamespace.h:45,
from /Library/Frameworks/QtCore.framework/Headers/qobjectdefs.h:45,
from /Library/Frameworks/QtCore.framework/Versions/4/Headers/qobject.h:47,
from /Library/Frameworks/QtCore.framework/Versions/4/Headers/QObject:1,
from SocketCommand.h:4,
from Authenticate.h:1,
[...]
make[1]: *** [Authenticate.o] Error 1
make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2
Gem files will remain installed in /Users/martinb/.rvm/gems/ruby-1.9.3-p374/gems/capybara-webkit-0.14.1 for inspection.
Results logged to /Users/martinb/.rvm/gems/ruby-1.9.3-p374/gems/capybara-webkit-0.14.1/./gem_make.out
So I installed the latest qt using homebrew:
> brew install qt
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/qt-4.8.2.mountainlion.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring qt-4.8.2.mountainlion.bottle.1.tar.gz
==> Caveats
We agreed to the Qt opensource license for you.
If this is unacceptable you should uninstall.
==> Summary
🍺 /usr/local/Cellar/qt/4.8.2: 2752 files, 197M
Then:
> 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/martinb/.rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
cd src/ && /usr/bin/qmake /Users/martinb/.rvm/gems/ruby-1.9.3-p374/gems/capybara-webkit-0.14.1/src/webkit_server.pro -spec /usr/local/Qt4.7/mkspecs/macx-g++ -o Makefile.webkit_server
cd src/ && make -f Makefile.webkit_server
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o EnableLogging.o EnableLogging.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o Authenticate.o Authenticate.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o SetConfirmAction.o SetConfirmAction.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o SetPromptAction.o SetPromptAction.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o SetPromptText.o SetPromptText.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o ClearPromptText.o ClearPromptText.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o JavascriptAlertMessages.o JavascriptAlertMessages.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o JavascriptConfirmMessages.o JavascriptConfirmMessages.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o JavascriptPromptMessages.o JavascriptPromptMessages.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o IgnoreSslErrors.o IgnoreSslErrors.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o ResizeWindow.o ResizeWindow.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o CurrentUrl.o CurrentUrl.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o ConsoleMessages.o ConsoleMessages.cpp
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o main.o main.cpp
main.cpp:2:17: error: QtGui: No such file or directory
main.cpp: In function ‘int main(int, char**)’:
main.cpp:16: error: ‘QApplication’ was not declared in this scope
main.cpp:16: error: expected `;' before ‘app’
main.cpp:17: error: ‘app’ was not declared in this scope
main.cpp: At global scope:
main.cpp:8: warning: unused parameter ‘argc’
main.cpp:8: warning: unused parameter ‘argv’
make[1]: *** [main.o] Error 1
make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2
Command 'make' failed
make
cd src/ && make -f Makefile.webkit_server
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/usr/include/QtGui -I/Library/Frameworks/QtWebKit.framework/Versions/4/Headers -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o main.o main.cpp
main.cpp:2:17: error: QtGui: No such file or directory
main.cpp: In function ‘int main(int, char**)’:
main.cpp:16: error: ‘QApplication’ was not declared in this scope
main.cpp:16: error: expected `;' before ‘app’
main.cpp:17: error: ‘app’ was not declared in this scope
main.cpp: At global scope:
main.cpp:8: warning: unused parameter ‘argc’
main.cpp:8: warning: unused parameter ‘argv’
make[1]: *** [main.o] Error 1
make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2
Gem files will remain installed in /Users/martinb/.rvm/gems/ruby-1.9.3-p374/gems/capybara-webkit-0.14.1 for inspection.
Results logged to /Users/martinb/.rvm/gems/ruby-1.9.3-p374/gems/capybara-webkit-0.14.1/./gem_make.out
I'm really, really stuck. Is there a solution for this? Thank you so much in advance.
回答1:
Whoa! I followed Paul's advice (THANK YOU Paul!) plus linked qmake to the new version. (Was 4.7.3, I needed it to use the latest 4.8.2).
Hint: qmake -v to see which version is in use.
Had I only known this... :P
来源:https://stackoverflow.com/questions/14638051/cannot-install-capybara-webkit-gem