The installation of rmgick fails even if you follow the instructions in the official documentation.
Does anyone know how to solve this problem?
official documentation:
ci
rmagick:
working_directory: ~/app
docker:
- image: circleci/ruby:2.5.1-node-browsers
steps:
- checkout
- run: sudo apt-get update && sudo apt-get install python3-pip groff-base
- run: sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
- restore_cache: &restore_gems_cache
keys:
- production-rails-peep-bundle-{{ checksum "Gemfile.lock" }}
- production-rails-peep-bundle-
- run: bundle check --path=vendor/bundle || bundle install --path vendor/bundle --jobs 4 --retry 3
The error log is as follows
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/bundle/gems/rmagick-4.1.2/ext/RMagick
/usr/local/bin/ruby -r ./siteconf20201109-18-1o9h6zv.rb extconf.rb
checking for brew... no
checking for pacman... no
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
Package 'MagickCore', required by 'virtual:world', not found
ERROR: Can't install RMagick 4.1.2.
Can't find the ImageMagick library or one of the dependent libraries.
Check the mkmf.log file for more detailed information.
*** 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.1.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/bundle/gems/rmagick-4.1.2 for
inspection.
Results logged to
/usr/local/bundle/extensions/x86_64-linux/2.5.0/rmagick-4.1.2/gem_make.out
An error occurred while installing rmagick (4.1.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '4.1.2' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
rmagick
The command '/bin/sh -c set -x && apk update && apk add --no-cache --virtual build-dependencies build-base git mysql-dev ca-certificates openssl && echo 'gem: --no-rdoc --no-ri' >> /.gemrc && gem install bundler && bundle install -j 4 && rm -rf /usr/lib/lib/ruby/gems/*/cache/* && rm -rf ~/.gem && apk del build-dependencies && apk add --no-cache mariadb-client-libs imagemagick' returned a non-zero code: 5
Exited with code exit status 5
CircleCI received exit code 5