概要
capybara-webkitをインストールしようとすると、qmakeコマンドがないといエラーが出てインストールできない。調べてみたことろ、CentOS7での解決方法がなかったので、CentOS6.4での対象方法を参考に、CentOS7でqmakeコマンドをインストールしてみた。
エラー内容
$ bundle install --path vendor/bundle
Installing capybara-webkit 1.11.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/vagrant/RSpec/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.11.1
/home/vagrant/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20160725-8249-16gn6j5.rb extconf.rb
*** 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=/home/vagrant/.rbenv/versions/2.3.1/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 ' not available
extconf failed, exit code 1
Gem files will remain installed in /home/vagrant/RSpec/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.11.1 for inspection.
Results logged to /home/vagrant/RSpec/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/capybara-webkit-1.11.1/gem_make.out
Using poltergeist 1.10.0
An error occurred while installing capybara-webkit (1.11.1), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.11.1'` succeeds before bundling.
qmakeのインストール手順
下記の内容で、/etc/yum.repos.d/qt.repo
を作成する。
epel-7
のレポジトリは存在しないので、baseurl
の部分のepel-$releasever
を、epel-6
に書き換える。
/etc/yum.repos.d/qt.repo
$ vi /etc/yum.repos.d/qt.repo
[epel-qt48]
name=Software Collection for Qt 4.8
#baseurl=http://repos.fedorapeople.org/repos/sic/qt48/epel-$releasever/$basearch/
baseurl=http://repos.fedorapeople.org/repos/sic/qt48/epel-6/$basearch/
enabled=1
skip_if_unavailable=1
gpgcheck=0
[epel-qt48-source]
name=Software Collection for Qt 4.8 - Source
#baseurl=http://repos.fedorapeople.org/repos/sic/qt48/epel-$releasever/SRPMS
baseurl=http://repos.fedorapeople.org/repos/sic/qt48/epel-6/SRPMS
enabled=0
skip_if_unavailable=1
gpgcheck=0
qtをインストール
$ sudo yum -y install qt48-qt-webkit-devel
qmakeコマンドのパスを通す
$ sudo ln -s /opt/rh/qt48/root/usr/include/QtCore/qconfig-64.h /opt/rh/qt48/root/usr/include/QtCore/qconfig-x86_64.h
$ source /opt/rh/qt48/enable
$ export PATH=/opt/rh/qt48/root/usr/lib64/qt4/bin/${PATH:+:${PATH}}
まとめ
これでbundle install
したら、capybara-webkitのインストールに成功した。
以上