Mac OS 10.14 Mojave + qt5.5 + gem capybara-webkit

时间:2018-10-05 08:09:43

标签: macos qt rubygems capybara-webkit

我的配置是MAC Mojave v10.14。

我尝试安装需要qt5.5的gem Capybara-webkit -v'1.15.0',但是qt5.5已被删除,并且与Xcode v10不兼容。

我尝试这个:

  • 卸载Xcode v10
  • 安装Xcode 9.4.1,可在developer.apple.com /
  • 中找到
  • 安装qt5.5,我在qt.io /
  • 的档案中找到了它
  • 运行捆绑包

但是失败了,我的错误是因为gem capybara-webkit -v'1.15.0':

Fetching capybara-webkit 1.15.0
Installing capybara-webkit 1.15.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: 
/Users/thomas/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/capybara- 
webkit-1.15.0
/Users/thomas/.rbenv/versions/2.4.4/bin/ruby -r ./siteconf20181005-763-1bppnfh.rb extconf.rb
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/thomas/.rbenv/versions/2.4.4/bin/$(RUBY_BASE_NAME)
--with-gl-dir
--without-gl-dir
--with-gl-include
--without-gl-include=${gl-dir}/include
--with-gl-lib
--without-gl-lib=${gl-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
Command 'qmake ' failed

extconf failed, exit code 1

 Gem files will remain installed in 
/Users/thomas/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-webkit-1.15.0 for inspection.
Results logged to /Users/thomas/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/extensions/x86_64- darwin-18/2.4.0-static/capybara-webkit-1.15.0/gem_make.out

An error occurred while installing capybara-webkit (1.15.0), and Bundler 
cannot continue.
Make sure that `gem install capybara-webkit -v '1.15.0' --source 
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
capybara-webkit

接下来,我做到了:

sudo xcodebuild -license agree

但是错误仍然存​​在...

谢谢您的帮助!

5 个答案:

答案 0 :(得分:6)

https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#Security_concerns所述,targetOrigin取决于Qt 5.5。 “ Qt 5.5是capybara-webkit将支持的Qt的最新版本。Qt项目已从5.6的二进制发行版中删除了WebKit绑定。”

要安装Qt 5.5,请按照Wiki中的说明进行操作。对于Mojave,说明如下。

capybara-webkit

您可以通过运行以下步骤来确认此步骤是否有效:

brew update
cd $( brew --prefix )/Homebrew/Library/Taps/homebrew/homebrew-core
git checkout 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 Formula/qt@5.5.rb
brew install qt@5.5
echo 'export PATH="$(brew --prefix qt@5.5)/bin:$PATH"' >> ~/.bashrc

接下来,您需要安装Xcode 9.4。 Xcode 10与Qt 5.5不兼容。可以从capybara-webkit wiki下载Xcode 9.4。这是4GB的下载,大约需要30分钟来下载和安装。您可以通过运行以下命令验证其是否正确安装:

$ which qmake
/usr/local/opt/qt@5.5/bin/qmake

如果这不起作用,可能是因为您仅安装了命令行工具而不是Xcode,在这种情况下,应确保您下载了正确版本的Xcode。否则Xcode文件夹可能设置不正确。如果是这样,您可以使用$ /usr/bin/xcodebuild -version Xcode 9.4.1 Build version 9F2000 来解决此问题,它将指定运行xcode-select的文件夹:

xcodebuild

最终安装Xcode后,将其放在“应用程序”文件夹中,将其打开,并同意许可。然后尝试重新安装sudo xcode-select -s /Applications/Xcode.app/Contents/Developer


免责声明:我通过编译多个问题和答案并试图记住在本地计算机上运行命令的顺序得出了以上答案。我可能不小心省略了一些步骤。

答案 1 :(得分:1)

我认为我的问题出在xcrun上。为了解决这个问题,我做到了:

  • sudo chown root:wheel /Applications/Xcode.app
  • sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
  • cd /Applications/Xcode.app/Contents/Developer/usr/bin/
  • sudo ln -s xcodebuild xcrun

工作正常(y)!

答案 2 :(得分:1)

这是对我有用的东西,found here

  • 继续安装xcode v10
  • 手动下载并安装Qt 5.5 from their website
  • 通过将Qt的bin路径添加到您的PATH.bashrc或您拥有的任何其他Shell配置中,将其添加到您的.zshrc环境变量中(请确保替换{{1} }和您的Qt bin路径)
/Applications/Qt/5.5/clang_64/bin
  • 运行export PATH="/Applications/Qt/5.5/clang_64/bin:$PATH" # Add Qt bin to path for capybara webkit to work

答案 3 :(得分:0)

您需要Xcode 9.4.1安装qt@5.5,因为它与Xcode 10不兼容。 Homebrew已从其核心分接头中删除了qt@5.5,因此要安装它,您需要先运行以下操作:

brew update
cd $( brew --prefix )/Homebrew/Library/Taps/homebrew/homebrew-core
git checkout 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 Formula/qt@5.5.rb
brew install qt@5.5

9ba3d6ef8891e5c15dbdc9333f857b13711d4e97360923286c0f1a6a1325ada578df030bf579009f的父提交,在那里他们删除了qt@5.5,因此此命令回滚到父提交并签出所需的公式文件。

答案 4 :(得分:0)

我可以使用以下方法在Mojave上安装 qt@5.5

brew install qt@5.5 --force-bottle

通过 capybara-webkit ,我暂时使用了此功能:

gem "capybara-webkit", git: "https://github.com/emilyst/capybara-webkit.git", ref: "9c9af833656f095667e8522004dae017d423d37d"