capybara-webkit (0.8.0) 无法在窗口 7 上构建 [英] capybara-webkit (0.8.0) failed to build on window 7

查看:23
本文介绍了capybara-webkit (0.8.0) 无法在窗口 7 上构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手.我正在尝试在窗口 7 上构建带有本机扩展的 capybara-webkit (0.8.0).我已经安装了(路径集):RubyMine、Ruby SDK 和 Gems、Rails、DevKit、Qt、gmake、g++.但我仍然收到以下错误消息.任何帮助是极大的赞赏.

I am a newbie. I am trying to build capybara-webkit (0.8.0) with native extensions on window 7. I already installed (path set):RubyMine, Ruby SDK and Gems, Rails, DevKit, Qt, gmake, g++. But I still got the following error msg. Any help is greatly appreciated.

$ gem install capybara-webkit -v '0.8.0'暂时增强 PATH 以包含 DevKit...构建原生扩展.这可能需要一段时间...错误:安装 capybara-webkit 时出错:错误:无法构建 gem 本机扩展.

$ gem install capybara-webkit -v '0.8.0' Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing capybara-webkit: ERROR: Failed to build gem native extension.

    c:/Ruby193/bin/ruby.exe extconf.rb

c:\Qt\4.8.2\bin\qmake.EXEc:\make\gmake.EXEcd src/&&c:/Qt/4.8.2/bin/qmake.exe c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src/webkit_server.pro -spec c:/Qt/4.8.2/mkspecs/macx-g++ -o Makef\ile.webkit_serverc:\make\gmake.EXEcd src/&&gmake -f Makefile.webkit_servergmake[1]: 进入目录`c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src'g++ -c -pipe -g -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_2_SEG-DQT_HAVE_2_SEG-DQT_HAVE_2_SEgs++/spec.80000000000000000000000000 -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX-Ic:/Qt/4.8.2/include/QtCore -Ic:/Qt/4.8.2/include/QtNetwork -Ic:/Qt/4.8.2/include/QtGui -Ic:/Qt/4.8.2/include/QtWebKit -Ic:/Qt/4.8.2/include -I.-o RequestedUrl.o RequestedUrl.cppprocess_begin: CreateProcess((null), g++ -c -pipe -g -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_XTs./DQT_HAVE_HAVE_S.Tm/-DQT_HAVE_HAVE_HAVE_S.T_Mac_DQT_HAVE_HAVE_S.Tm-g++ -I. -Ic:/Qt/4.8.2/include/QtCore -Ic:/Qt/4.8.2/include/QtNetwork -Ic:/Qt/4.8.2/include/QtGui -Ic:/Qt/4.8.2/include/QtWebKit -Ic:/Qt/4.8.2/include -I. -o RequestedUrl.o RequestedUrl.cpp, ...) 失败.make (e=2):系统找不到指定的文件.

c:\Qt\4.8.2\bin\qmake.EXE c:\make\gmake.EXE cd src/ && c:/Qt/4.8.2/bin/qmake.exe c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src/webkit_server.pro -spec c:/Qt/4.8.2/mkspecs/macx-g++ -o Makef\ile.webkit_server c:\make\gmake.EXE cd src/ && gmake -f Makefile.webkit_server gmake[1]: Entering directory `c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src' g++ -c -pipe -g -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -Ic:/Qt/4.8.2/mkspecs/macx-g++ -I. -Ic:/Qt/4.8.2/include/QtCore -Ic:/Qt/4.8.2/include/QtNetwork -Ic:/Qt/4.8.2/include/QtGui -Ic:/Qt/4.8.2/include/QtWebKit -Ic:/Qt/4.8.2/include -I. -o RequestedUrl.o RequestedUrl.cpp process_begin: CreateProcess((null), g++ -c -pipe -g -Wall -W -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -Ic:/Qt/4.8.2/mkspecs/macx-g++ -I. -Ic:/Qt/4.8.2/include/QtCore -Ic:/Qt/4.8.2/include/QtNetwork -Ic:/Qt/4.8.2/include/QtGui -Ic:/Qt/4.8.2/include/QtWebKit -Ic:/Qt/4.8.2/include -I. -o RequestedUrl.o Req uestedUrl.cpp, ...) failed. make (e=2): The system cannot find the file specified.

gmake[1]: * [RequestedUrl.o] 错误 2gmake[1]: 离开目录 c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src'c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1515:instat': 没有那个文件或目录- src/webkit_server (Errno::ENOENT)来自 c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1515:in block in fu_each_src_dest'来自 c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1529:infu_each_src_dest0'来自 c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1513:in fu_each_src_dest'来自 c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:395:incp'来自 c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/lib/capybara_webkit_builder.rb:33:in build'来自 c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/lib/capybara_webkit_builder.rb:39:inbuild_all'来自 extconf.rb:2:in `'

gmake[1]: * [RequestedUrl.o] Error 2 gmake[1]: Leaving directory c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/src' c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1515:instat': No such file or directory - src/webkit_server (Errno::ENOENT) from c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1515:in block in fu_each_src_dest' from c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1529:infu_each_src_dest0' from c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1513:in fu_each_src_dest' from c:/Ruby193/lib/ruby/1.9.1/fileutils.rb:395:incp' from c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/lib/capybara_webkit_builder.rb:33:in build' from c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/lib/capybara_webkit_builder.rb:39:inbuild_all' from extconf.rb:2:in `'

Gem 文件将保留安装在 c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0 以供检查.结果记录到 c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/./gem_make.out

Gem files will remain installed in c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0 for inspection. Results logged to c:/Ruby193/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.8.0/./gem_make.out

推荐答案

我遇到了与此类似的错误,以及以下错误:

I was getting similar errors to this, as well as errors such as:

g++.exe: 无法识别的选项 '-headerpad_max_install_names'

make[1]: 离开目录/ruby/gems/shared/gems/capybara-webkit-0.12.1/src'

Errno::ENOENT: 没有那个文件或目录 - C:/JRuby/lib/ruby/gems/shared/gems/capybara-webkit-0.12.1/src/webkit_server

加载错误:没有要加载的文件

没有那个文件或目录 - C:/Ruby/capybara-webkit-0.12.1/src/webkit_server

基本上,所有这些错误的答案都与您在 Windows 上安装的 capybara-webkit 版本有关,具体取决于 QT 的正确版本以及 mingw 工具集中包含的 g++ 编译器的正确版本.必须安装正确的版本,并将正确的 bin 目录添加到您的 Windows 路径中.

Basically the answer to all these errors is to do with the version of capybara-webkit that you install on Windows depending on exactly the right versions of QT, and the right version of the g++ compiler included in mingw toolset. The right versions have to be installed and the correct bin directories added to your windows path.

另外,RbConfig::CONFIG['host_os'] 存在问题,它在 Windows 8 上返回mswin32"而不是mingw32".因此,您必须将 capybara_webkit_builder.rb 和 spec_helper.rb 修复为以下内容:/mingw32|mswin32/.如果你不这样做,那么你将运行 macx-g++,它在 Windows 上不起作用.你必须在 windows 上运行 win32-g++.

Plus, there are issues with RbConfig::CONFIG['host_os'] which on windows 8 returns "mswin32" and not "mingw32". Therefore you have to fix capybara_webkit_builder.rb and spec_helper.rb to the following: /mingw32|mswin32/. If you don't do this then you will run macx-g++ which won't work on windows. You have to run win32-g++ on windows.

如果您使用的是 JRuby,则 RUBY_PLATFORM 设置为java".因此,您必须将相应的 capybara_webkit_builder.rb 和 connection.rb 更改为 /mingw32|java/.如果您不这样做,则二进制文件将编译(但连接中存在错误),但编译器将因找不到 webkit-server 错误而崩溃.

If you're using JRuby, then the RUBY_PLATFORM is set to "java". Therefore you have to change corresponding capybara_webkit_builder.rb and connection.rb to /mingw32|java/. If you don't do this, then the binary will compile (but with a bug in connection) but the compiler will crash out with the can't find the webkit-server error.

您必须遵循 上的安装脚本https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit

在windows的最后一条指令中,你必须cd"到gem目录然后运行

At the final instruction on windows, you have to "cd" to the gem directory and then run

bundle exec gem install capybara-webkit-0.12.1.gem

或您构建的任何版本.

因此,答案是获取每个依赖项的所有正确版本,修复错误,确保 Windows 路径变量指向正确版本的 g++ 编译器(不要忘记在更改路径变量后重新启动 cmd) 然后确保您在运行命令时位于正确的目录中.

So, the answers are get all the right versions of each dependency, fix the bugs, ensure the windows path variable points to the right versions of g++ compilers (don't forget to restart cmd after you've changed the path variable) and then ensure you're in the right directory when you run commands.

这篇关于capybara-webkit (0.8.0) 无法在窗口 7 上构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆