rmagick: Can't install rmagick in Docker Alpine
Our containers run on Docker Alpine ruby:2.5.3-alpine.
I installed ImageMagick but found no way to install this gem. This looks similar to #282 but Alpine has so many things(software) left out compared to CentOS.
Error message:
Fetching rmagick 4.0.0
Installing rmagick 4.0.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/bundle/gems/rmagick-4.0.0/ext/RMagick
/usr/local/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.5.0 -r
./siteconf20191031-56-1elb4ic.rb extconf.rb
checking for brew... no
checking for pacman... no
checking for gcc... yes
checking for pkg-config... yes
ERROR: Can't install RMagick 4.0.0. Can't find ImageMagick with
pkg-config
*** 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=/usr/local/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/usr/local/bundle/extensions/x86_64-linux/2.5.0/rmagick-4.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/bundle/gems/rmagick-4.0.0 for
inspection.
Results logged to
/usr/local/bundle/extensions/x86_64-linux/2.5.0/rmagick-4.0.0/gem_make.out
An error occurred while installing rmagick (4.0.0), and Bundler cannot continue.
Make sure that `gem install rmagick -v '4.0.0' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
rmagick
This isn’t maybe the place but wanted to add the issue for the record as I didn’t find a way to install in Docker Alpine images.
Installing pkg-config in Alpine wasn’t possible as well.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 15 (9 by maintainers)
Imagemagick7 is not yet compatible with rmagick. So installing Imagemagick6 worked for me.
pkg-configis not correctly listing for installed packages on AlpineLinux. RMagick depends on pkg-config. Unfortunately this cannot be solved, so can you report this to proper community ?Dockerfile
Result
I think It is tough because there is no header files of ImageMagick within Alpine package.
If you want to use Alpine, I think you need to build ImageMagick by yourself from source.
Thanks for the followup @cesc1989. Can you also provide the output from the
mkmf.logfile mentioned?@cesc1989 were you able to install the latest version of RMagick?
@cesc1989 It seems RMagick can’t find an ImageMagick installation. Can you verify which version of ImageMagick you have installed with
convert --versionoridentify --version? Also, please note, RMagick 4.0 and before do not support ImageMagick >= 7. If you have ImageMagick 7, you can try our4.1.0.rc2gem.