我可以使用homebrew的qt5和capybara-webkit吗?

时间:2021-11-28 20:32:33

I want to use qt5's QtWebKit with capybara-webkit.

我想将qt5的QtWebKit与capybara-webkit一起使用。

brew uninstall qt
Uninstalling /usr/local/Cellar/qt/4.8.4...
brew install qt5
This formula is keg-only: so it was not symlinked into /usr/local.
????  /usr/local/Cellar/qt5/5.0.2: 3103 files, 140M, built in 60.9 minutes

If I force brew to create the symlinks for qt5 I can build the native extension for capybara-webkit ..

如果我强制brew为qt5创建符号链接,我可以为capybara-webkit构建原生扩展。

brew link --force qt5
Linking /usr/local/Cellar/qt5/5.0.2... 122 symlinks created
gem install capybara-webkit -v '1.0.0'
Successfully installed capybara-webkit-1.0.0

.. but webkit_server crashes hard ..

..但是webkit_server很难崩溃..

bundle exec rake test:integration
Errno::EADDRNOTAVAIL: Can't assign requested address - connect(2)
dyld: Library not loaded: /private/tmp/qt5-KytU/qt-everywhere-opensource-src-5.0.2/qtwebkit/lib/QtWebKit.framework/Versions/5/QtWebKit
  Referenced from: /usr/local/opt/qt5/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
  Reason: image not found

See full osx crash report.

查看完整的osx崩溃报告。

I tried installing capybara-webkit with LDFLAGS and CPPFLAGS but webkit_server still crashes hard.

我尝试使用LDFLAGS和CPPFLAGS安装capybara-webkit,但webkit_server仍然很难崩溃。

env LDFLAGS=-L/usr/local/opt/qt5/lib \
  CPPFLAGS=-I/usr/local/opt/qt5/include \
  gem install capybara-webkit -v '1.0.0'

4 个解决方案

#1


27  

NOTE: IAmNaN here... this answer worked find for El Cap and Yosemite but it is no longer relevant as of MacOS Sierra. Instead follow the instructions from Thoughtbot. To summarize...

注意:IAmNaN在这里...这个答案适用于El Cap和Yosemite,但它与MacOS Sierra不再相关。而是按照Thoughtbot的说明进行操作。总结一下......

  1. Download and install a new Qt from here.
  2. 从这里下载并安装新的Qt。
  3. Edit ~/Qt5.5.1/5.5/clang_64/mkspecs/features/mac/default_pre.prf.
  4. 编辑〜/ Qt5.5.1 / 5.5 / clang_64 / mkspecs / features / mac / default_pre.prf。
  5. Around line 15 find and replace -find xcrun 2 with -find xcodebuild 2.
  6. 第15行找到并用-find xcodebuild 2替换-find xcrun 2。
  7. Save and run PATH=~/Qt5.5.1/5.5/clang_64/bin:$PATH gem install capybara-webkit
  8. 保存并运行PATH =〜/ Qt5.5.1 / 5.5 / clang_64 / bin:$ PATH gem install capybara-webkit

Now back to our regularly scheduled answer....

现在回到我们定期安排的答案....

I got this to work on OSX Yosemite. The reason for building against Qt5 was to get some fixes not in Qt4 that prevented capybara-webkit from using font and stylesheet assets in some circumstances.

我让这个在OSX Yosemite上工作。构建Qt5的原因是为了获得一些不在Qt4中的修复,这些修复阻止了capybara-webkit在某些情况下使用字体和样式表资产。

Comment out the capybara and capybara-webkit gems from your gemfile. Then:

从gemfile中注释掉capybara和capybara-webkit gems。然后:

bundle
gem uninstall capybara-webkit
gem uninstall capybara # if it complains about dependencies 'gem uninstall' them first
brew remove qt
brew remove qt5 # if you've been playing around

From a clean environment (restart your terminal):

从干净的环境(重启终端):

brew tap homebrew/versions
brew install qt55
brew linkapps qt55
brew link --force qt55

Uncomment capybara and capybara-webkit in the gemfile and then:

在gemfile中取消注释capybara和capybara-webkit,然后:

bundle install

Note: You may safely ignore the "brew unlink" warnings issued by brew doctor.

注意:您可以放心地忽略brew医生发出的“brew unlink”警告。

#2


7  

Two years later, the same steps from my question now work. Thanks, whoever fixed it.

两年后,我的问题中的相同步骤现在起作用。谢谢,无论谁修复它。

gem uninstall --all capybara-webkit
brew remove qt
brew install qt5
brew linkapps qt5 # optional?
brew link --force qt5
gem install capybara-webkit

After installing qt5, I no longer see this message from my test suite:

安装qt5后,我不再从我的测试套件中看到此消息:

WARNING: The next major version of capybara-webkit will require at least version 5.0 of Qt.

Uninstalling the capybara gem is not necessary (as other answers suggest) because it has no native extensions, thus no direct dependency on QT.

卸载capybara gem是没有必要的(正如其他答案所示),因为它没有原生扩展,因此没有直接依赖QT。

#3


4  

According to https://github.com/thoughtbot/capybara-webkit/issues/885 , QT stopped working with webkit at version 5.6. However, there is a qt55 brew available, so use qt55 (instead of qt5) in the answers above.

根据https://github.com/thoughtbot/capybara-webkit/issues/885,QT停止使用5.6版本的webkit。但是,有一个qt55 brew可用,所以在上面的答案中使用qt55(而不是qt5)。

#4


0  

I suggest to brew update, brew remove qt5 and brew install qt5, because I find on my system, that:

我建议brew brew,brew删除qt5和brew install qt5,因为我在我的系统上找到了:

xcrun otool -L /usr/local/Cellar/qt5/5.0.2/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
[snip] 
/usr/local/Cellar/qt5/5.0.2/src/qtwebkit/lib/QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.0.0, current version 5.0.2)

So Qt5 does link against QtWebKit and the link is valid on my system in contrast to yours. Therefore the suggestion to reinstall. If homebrew installs the prebuilt bottle and still has this issue, please report on Homebrew's issue tracker on github. I installed mine from source.

所以Qt5确实与QtWebKit链接,并且该链接在我的系统上有效,与您的相反。因此建议重新安装。如果自制软件安装了预制的瓶子并且仍有此问题,请在github上报告Homebrew的问题跟踪器。我从源头安装了我的。

However, I guess an upstream issue (a minor one) is that the link points into src which should probably lib. But that is up to Qt to fix.

但是,我猜一个上游问题(一个小问题)是链接指向src,它应该是lib。但这要由Qt修复。

#1


27  

NOTE: IAmNaN here... this answer worked find for El Cap and Yosemite but it is no longer relevant as of MacOS Sierra. Instead follow the instructions from Thoughtbot. To summarize...

注意:IAmNaN在这里...这个答案适用于El Cap和Yosemite,但它与MacOS Sierra不再相关。而是按照Thoughtbot的说明进行操作。总结一下......

  1. Download and install a new Qt from here.
  2. 从这里下载并安装新的Qt。
  3. Edit ~/Qt5.5.1/5.5/clang_64/mkspecs/features/mac/default_pre.prf.
  4. 编辑〜/ Qt5.5.1 / 5.5 / clang_64 / mkspecs / features / mac / default_pre.prf。
  5. Around line 15 find and replace -find xcrun 2 with -find xcodebuild 2.
  6. 第15行找到并用-find xcodebuild 2替换-find xcrun 2。
  7. Save and run PATH=~/Qt5.5.1/5.5/clang_64/bin:$PATH gem install capybara-webkit
  8. 保存并运行PATH =〜/ Qt5.5.1 / 5.5 / clang_64 / bin:$ PATH gem install capybara-webkit

Now back to our regularly scheduled answer....

现在回到我们定期安排的答案....

I got this to work on OSX Yosemite. The reason for building against Qt5 was to get some fixes not in Qt4 that prevented capybara-webkit from using font and stylesheet assets in some circumstances.

我让这个在OSX Yosemite上工作。构建Qt5的原因是为了获得一些不在Qt4中的修复,这些修复阻止了capybara-webkit在某些情况下使用字体和样式表资产。

Comment out the capybara and capybara-webkit gems from your gemfile. Then:

从gemfile中注释掉capybara和capybara-webkit gems。然后:

bundle
gem uninstall capybara-webkit
gem uninstall capybara # if it complains about dependencies 'gem uninstall' them first
brew remove qt
brew remove qt5 # if you've been playing around

From a clean environment (restart your terminal):

从干净的环境(重启终端):

brew tap homebrew/versions
brew install qt55
brew linkapps qt55
brew link --force qt55

Uncomment capybara and capybara-webkit in the gemfile and then:

在gemfile中取消注释capybara和capybara-webkit,然后:

bundle install

Note: You may safely ignore the "brew unlink" warnings issued by brew doctor.

注意:您可以放心地忽略brew医生发出的“brew unlink”警告。

#2


7  

Two years later, the same steps from my question now work. Thanks, whoever fixed it.

两年后,我的问题中的相同步骤现在起作用。谢谢,无论谁修复它。

gem uninstall --all capybara-webkit
brew remove qt
brew install qt5
brew linkapps qt5 # optional?
brew link --force qt5
gem install capybara-webkit

After installing qt5, I no longer see this message from my test suite:

安装qt5后,我不再从我的测试套件中看到此消息:

WARNING: The next major version of capybara-webkit will require at least version 5.0 of Qt.

Uninstalling the capybara gem is not necessary (as other answers suggest) because it has no native extensions, thus no direct dependency on QT.

卸载capybara gem是没有必要的(正如其他答案所示),因为它没有原生扩展,因此没有直接依赖QT。

#3


4  

According to https://github.com/thoughtbot/capybara-webkit/issues/885 , QT stopped working with webkit at version 5.6. However, there is a qt55 brew available, so use qt55 (instead of qt5) in the answers above.

根据https://github.com/thoughtbot/capybara-webkit/issues/885,QT停止使用5.6版本的webkit。但是,有一个qt55 brew可用,所以在上面的答案中使用qt55(而不是qt5)。

#4


0  

I suggest to brew update, brew remove qt5 and brew install qt5, because I find on my system, that:

我建议brew brew,brew删除qt5和brew install qt5,因为我在我的系统上找到了:

xcrun otool -L /usr/local/Cellar/qt5/5.0.2/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
[snip] 
/usr/local/Cellar/qt5/5.0.2/src/qtwebkit/lib/QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.0.0, current version 5.0.2)

So Qt5 does link against QtWebKit and the link is valid on my system in contrast to yours. Therefore the suggestion to reinstall. If homebrew installs the prebuilt bottle and still has this issue, please report on Homebrew's issue tracker on github. I installed mine from source.

所以Qt5确实与QtWebKit链接,并且该链接在我的系统上有效,与您的相反。因此建议重新安装。如果自制软件安装了预制的瓶子并且仍有此问题,请在github上报告Homebrew的问题跟踪器。我从源头安装了我的。

However, I guess an upstream issue (a minor one) is that the link points into src which should probably lib. But that is up to Qt to fix.

但是,我猜一个上游问题(一个小问题)是链接指向src,它应该是lib。但这要由Qt修复。