Posted at

capybara-webkitインストール時に"qmake not available"


このruby version のDocker image を使用 :

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]


問題

# gem install capybara-webkit

Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.

current directory: /usr/local/bundle/gems/capybara-webkit-1.15.1
/usr/local/bin/ruby -r ./siteconf20181206-95-ixbkmk.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
...
Command 'qmake ' not available

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/capybara-webkit-1.15.1 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.5.0/capybara-webkit-1.15.1/gem_make.out


対処


これを参照して、先にqtをインストールしておく

Installing Qt and compiling capybara webkit

sudo apt-get update

sudo apt-get install qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x


Dockerfile :

RUN apt-get update

RUN \
apt-get install -y \
qt5-default \
libqt5webkit5-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-tools \
gstreamer1.0-x