问题
I get the following error when trying to execute any capybara test using the capybara-webkit driver:
dyld: Library not loaded: /usr/X11/lib/libpng15.15.dylib Referenced from: /usr/local/Cellar/qt/4.8.0/lib/QtGui.framework/Versions/4/QtGui Reason: Incompatible library version: QtGui requires version 20.0.0 or later, but libpng15.15.dylib provides version 17.0.0 /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit/browser.rb:200:in
initialize': Can't assign requested address - connect(2) (Errno::EADDRNOTAVAIL) from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit/browser.rb:200:in
open' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit/browser.rb:200:inattempt_connect' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit/browser.rb:194:in
block in connect' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.1.2/lib/capybara/util/timeout.rb:13:intimeout' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit/browser.rb:193:in
connect' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit/browser.rb:17:ininitialize' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit.rb:25:in
new' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit.rb:25:ininitialize' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/webkit.rb:5:in
new' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/webkit.rb:5:inblock in <top (required)>' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.1.2/lib/capybara/session.rb:61:in
call' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.1.2/lib/capybara/session.rb:61:indriver' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.1.2/lib/capybara/session.rb:157:in
visit' from /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.1.2/lib/capybara/dsl.rb:161:in `visit'
I understand the problem is due to the version of libpng it appears to be attempting to use, but I'm not sure how to fix it. I've downloaded the latest libpng source and compiled it, but I'm assuming that there is something in the capybara-webkit gem installation where either the webkit binaries are getting linked against the ones shown in the stack trace or something. I'm just not sure how to fix it. Any guidance is appreciated.
I'm using Max OS X 10.7, Ruby 1.9.2, capybara version 1.1.2, and capybara-webkit 0.9.0.
EDIT: To answer the question in the comments - yes, Qt was installed using homebrew. I'm not sure what I would do differently though - are you suggesting doing something with LD_LIBRARY_PATH?
回答1:
I ran into this same issue and fixed it by completely removing qt and reinstalling, using the following steps.
Remove QT
brew uninstall qt
sudo python uninstall-qt.py (I think in /Developer/Tools)
Install QT
brew update
brew doctor - fix any issues
brew install qt4 or brew install qt4 --build-from-source
来源:https://stackoverflow.com/questions/9244688/error-using-capybara-webkit-really-qtwebkit-webkit-server-on-macos-x-due-to-li