I am setting-up my VM Ubuntu 18.04.03 on MacOS.
GIVEN:
Ubuntu 18.04.03 LTS
ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Expected Rails version set in Gemfile is '4.2.7.1'
The system suggests to run gem install rmagick -v '2.13.2'
When I run bundle install in the terminal I am getting the following error:
Installing rmagick 2.13.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/i.k/.rvm/gems/ruby-2.1.2/gems/rmagick-2.13.2/ext/RMagick
/usr/share/rvm/rubies/ruby-2.1.2/bin/ruby -I
/usr/share/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0 -r
./siteconf20200113-25302-1t913rc.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.2. Can't find Magick-config in
/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:/home/i.k/.rvm/gems/ruby-2.1.2/bin:/home/i.k/.rvm/gems/ruby-2.1.2@global/bin:/usr/share/rvm/rubies/ruby-2.1.2/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/usr/share/rvm/bin
*** 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/share/rvm/rubies/ruby-2.1.2/bin/ruby
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/home/i.k/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/rmagick-2.13.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/home/i.k/.rvm/gems/ruby-2.1.2/gems/rmagick-2.13.2 for inspection.
Results logged to
/home/i.k/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/rmagick-2.13.2/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.13.2' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rmagick
When I run the gem install rmagick -v'2.13.2' --source 'https://rubygems.org/'
I am getting the following error
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /home/i.k/.rvm/gems/ruby-2.1.2/gems/rmagick-2.13.2/ext/RMagick
/usr/share/rvm/rubies/ruby-2.1.2/bin/ruby -I /usr/share/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0 -r ./siteconf20200114-15956-1hlaeuw.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.2. Can't find Magick-config in /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:/home/i.k/.rvm/gems/ruby-2.1.2/bin:/home/i.k/.rvm/gems/ruby-2.1.2@global/bin:/usr/share/rvm/rubies/ruby-2.1.2/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/usr/share/rvm/bin
*** 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/share/rvm/rubies/ruby-2.1.2/bin/ruby
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/i.k/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/rmagick-2.13.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/i.k/.rvm/gems/ruby-2.1.2/gems/rmagick-2.13.2 for inspection.
Results logged to /home/i.k/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/rmagick-2.13.2/gem_make.out
I already tried the following :
sudo apt install imagemagick libmagickcore-dev libmagickwand-dev
0 gems installed - no result
sudo apt install libmagickcore-dev
0 gems installed -no result
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
nothing happened when I ran gem rmagick install - the error stayed the same
UPD. mkmf.log says:
find_executable: checking for Magick-config... -------------------- no
--------------------
Can't install RMagick 2.13.2. Can't find Magick-config in /home/i.k/.rvm/gems/ruby-2.1.2/bin:/home/i.k/.rvm/gems/ruby-2.1.2@global/bin:/usr/share/rvm/rubies/ruby-2.1.2/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/usr/share/rvm/bin
Any help would be appreciated
I actually figured it out. This is what helped in my particular case. Who knows, it might help someone else. From the project directory, I did this.
First I ran locate libMagick
to make sure that I have it and that it is located where it is supposed to be.
Second I ran locate Magick-config
I also ran convert -version
in terminal to make sure that I have the Imagemagic and to check what version it has.
To be on the safe side as some people suggest that it is not always pre-installed on Ubuntu I also checked the make
with
find / -iname "make" 2>/dev/null
it is normally installed in /usr/bin/make
and mine was.
The fix suggested as an option with the PATH variable looks like this:
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
It can be a no-brainer for someone who has dealt with this for a day or more but it could get tricky for a newbie.
So MAKE SURE to compare the version of the ImageMagick that you have and update it accordingly in this PATH command.
Also it is case sensitive and in my case the "Q" is not a capital "Q" but a small one. I found it from the location path of the Magick-config( see the command that I ran above).
As a result my PATH looked like this:PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16:$PATH"
So I ran sudo apt-get update
to clear all the cache and then ran the correct PATH command in terminal and voila. If anyone wants to add anything or correct me on my logic please do, all comments are welcome.