環境
項目 | バージョン |
---|---|
OS | CentOS 6.5 |
Ruby | ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux] |
Rails | 4.1.6 |
xml2-config | 2.7.6 |
xslt-config | 1.1.26 |
状況
-
rails new
で新規プロジェクトを作成 - Gemfile に
capybara
とcapybara-webkit
を追加 -
bundle install
を実行 - 次のエラーが発生
エラー
[vagrant@vagrant-centos65 foo]$ bundle
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
# --- 省略 ---
Using capybara 2.4.4
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/vagrant/.rbenv/versions/2.1.3/bin/ruby extconf.rb
Command 'qmake -spec linux-g++ ' not available
Makefile not found
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/capybara-webkit-1.3.1 for inspection.
Results logged to /home/vagrant/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/capybara-webkit-1.3.1/gem_make.out
An error occurred while installing capybara-webkit (1.3.1), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.3.1'` succeeds before bundling.
対策
このページの CentOS 6.5 の場合の手順に従って作業する。
Installing Qt and compiling capybara webkit · thoughtbot/capybara-webkit Wiki
1.Qtのソースをダウンロード
$ cd ~/Downloads
$ wget http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz
2.configure
$ tar xzvf qt-everywhere-opensource-src-4.8.6.tar.gz
$ cd qt-everywhere-opensource-src-4.8.6
$ ./configure
Which edition of Qt do you want to use ?
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
o
{--SNIP--}
Qt is now configured for building. Just run 'gmake'.
Once everything is built, you must run 'gmake install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.8.6
To reconfigure, run 'gmake confclean' and 'configure'.
この時にこんなエラーが表示された時は [Qtインストール時のトラブルシューティング] を参照。
エラー
# ---省略---
Basic XLib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/vagrant/Downloads/qt-everywhere-opensource-src-4.8.6/mkspecs/linux-g++.
3.コンパイル
$ gmake
4.インストール
$ sudo gmake install
$ sudo ln -s /usr/local/Trolltech/Qt-4.8.6/bin/qmake /usr/bin/qmake