rmagick and imagemagick bundle/homebrew error - ruby-on-rails

Please see error stack below. I tried uninstall/install of imagemagick via homebrew, 'gem pristine rmagick', and reinstall of rmagick. All have returned the same error. Any help would be VERY much appreciated- been at this for a while now.
$ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/LU/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for /usr/local/bin/gcc-4.2... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagick++... no
Can't install RMagick 2.13.1. 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
--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=/Users/Lungs/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
--with-MagickCorelib
--without-MagickCorelib
--with-Magicklib
--without-Magicklib
--with-Magick++lib
--without-Magick++lib
Gem files will remain installed in /Users/Lungs/.rvm/gems/ruby-1.9.3-p362/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/LU/.rvm/gems/ruby-1.9.3-p362/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

Had the same problem, easy fix!
https://github.com/mxcl/homebrew/issues/16625
here is the skinny on the solution (rmagick is broken, and you have to create symlinks to get it to work):
cd /usr/local/Cellar/imagemagick/6.8.0-10/lib
ln -s libMagick++-Q8.7.dylib libMagick++.dylib
ln -s libMagickCore-Q8.7.dylib libMagickCore.dylib
ln -s libMagickWand-Q8.7.dylib libMagickWand.dylib

Alternatively, step back one ImageMagick rev:
(via https://stackoverflow.com/a/9832084/485836)
> cd /usr/local
> brew versions imagemagick
6.7.7-6 git checkout 883f549 Library/Formula/imagemagick.rb
6.7.5-7 git checkout f965101 Library/Formula/imagemagick.rb
6.7.1-1 git checkout be8e0ff Library/Formula/imagemagick.rb
...
> git checkout 883f549 Library/Formula/imagemagick.rb
> brew install imagemagick

A better way to get the headers into the proper place might be to just add the pkgconfig from the imagemagick Cellar to your PKG_CONFIG_PATH.
Adding the following to my ~/.bash_profile and then sourcing it (source ~/.bash_profile) worked for me
export PKG_CONFIG_PATH="/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig:$PKG_CONFIG_PATH"

Ended up being an issue with rails version, needed to update and reinstall imagemagick/rmagick.

brew install imagemagick
should do the trick. Then reinstall the gems.

Related

ERROR: Error installing rmagick on Redhat 7

I am trying to run my Rails application in Redhat7 but facing this error when I run bundle install:
An error occurred while installing rmagick (2.13.4), and Bundler
cannot continue. Make sure that gem install rmagick -v '2.13.4'
succeeds before bundling.
When I run gem install rmagick, this is the error I am getting:
[root#ip-172-12-13-148 MyProject]# gem install rmagick -v '2.13.4'
Building native extensions. This could take a while... ERROR: Error
installing rmagick: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/rmagick-2.13.4/ext/RMagick
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r
./siteconf20160818-2119-1nvxrgu.rb extconf.rb checking for Ruby
version >= 1.8.5... yes checking for gcc... yes checking for
Magick-config... no checking for pkg-config... yes checking for
ImageMagick version >= 6.4.9... 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
No package 'MagickCore' found Package MagickCore was not found in the
pkg-config search path. Perhaps you should add the directory
containingMagickCore.pc' to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found 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
No package 'MagickCore' found Package MagickCore was not found in the
pkg-config search path. Perhaps you should add the directory
containingMagickCore.pc' to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found checking for stdint.h... yes checking
for sys/types.h... yes checking for wand/MagickWand.h... no
Can't install RMagick 2.13.4. Can't find MagickWand.h.
* 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/rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log
which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/rmagick-2.13.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/usr/local/rvm/gems/ruby-2.3.0/gems/rmagick-2.13.4 for inspection.
Results logged to
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/rmagick-2.13.4/gem_make.out
I tried using
yum install IMageMagickand run bundle, but issue continues.
[root#ip-172-12-13-148 MyProject]# yum install ImageMagick-devel
then:
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package ImageMagick-devel available.
Error: Nothing to do Please help.
Please help.
For RedHat try running this command
yum install ImageMagick ImageMagick-devel
Refer - this

Installing RMagick gem on Mountain Lion show errors 'Abort trap: 6'

I've installed ImageMagick(6.8.6-3) by Homebrew.
When try to install rmagick gem(2.13.2) on Max OS X Mountain Lion, show errors 'Abort trap: 6'
gem install rmagick -v 2.13.2
Abort trap: 6
When switch version to '2.13.1', show errors below.
gem install rmagick -v 2.13.1
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for wand/MagickWand.h... no
Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** 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=/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby
Gem files will remain installed in /Users/Macmini/.rvm/gems/ruby-1.8.6-p420#sis/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/Macmini/.rvm/gems/ruby-1.8.6-p420#sis/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
I can't figure out what's wrong?
to install rmagick 2.13.1 on mac, you need Imagemagick version 6.7.x (it wont work with 6.8.x). And you may have to run this command before installing the gem
cd "`Magick-config --prefix`/lib"; ln -s libMagick++-Q8.7.dylib libMagick++.dylib; ln -s libMagickCore-Q8.7.dylib libMagickCore.dylib; ln -s libMagickWand-Q8.7.dylib libMagickWand.dylib
The above is actually equivalent of running these commands
cd "`Magick-config --prefix`lib"
ln -s libMagick++-Q16.7.dylib libMagick++.dylib
ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
After this, you can
gem install rmagick -v '2.13.1'
And to install ImageMagick 6.7 using homebrew, run these commands
cd /usr/local/
brew versions imagemagick
You should see something like this
6.8.0-10 git checkout 883f549 /usr/local/Library/Formula/imagemagick.rb
6.7.7-6 git checkout 834ce4a /usr/local/Library/Formula/imagemagick.rb
6.7.5-7 git checkout f965101 /usr/local/Library/Formula/imagemagick.rb
6.7.1-1 git checkout be8e0ff /usr/local/Library/Formula/imagemagick.rb
6.6.9-4 git checkout 4e7c332 /usr/local/Library/Formula/imagemagick.rb
6.6.7-10 git checkout 0476235 /usr/local/Library/Formula/imagemagick.rb
6.6.7-8 git checkout db99927 /usr/local/Library/Formula/imagemagick.rb
6.6.7-1 git checkout 7cd042f /usr/local/Library/Formula/imagemagick.rb
6.6.4-5 git checkout 53886de /usr/local/Library/Formula/imagemagick.rb
Then choose your version by running
git checkout 834ce4a /usr/local/Library/Formula/imagemagick.rb
followed by
brew install imagemagick

Rmagick and carrierwave installment in dreamhost vps

I am trying to install carrierwave not on my machine but on a vps hosted on dreamhost.
Here the Gemfile
gem "rmagick"
gem 'carrierwave'
Here the error when bundling:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/wywvps/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for gcc... yes
checking for Magick-config... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/usr/bin/Magick-config reports version 6.6.0 Q16 is installed in /usr
/usr/bin/X11/Magick-config reports version 6.6.0 Q16 is installed in /usr
Using 6.6.0 Q16 from /usr.
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** 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
--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/wywvps/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
Gem files will remain installed in /home/wywvps/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1 for inspection.
Results logged to /home/wywvps/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
try installing
sudo apt-get install libmagickwand-dev imagemagick
It says that you do not have "MagickWand.h" file in the wand folder.
Please check that in your installation folder of your ImageMagick is this file located.
Petr

Error in rmagick installation in ruby and rails

Hiall,
I am new to ROR . I am trying to install rmagick on my local machine . When I try to install it everytime i get the following error :
Please help me out with this situation .
D:\ruby\bin>gem install rmagick --platform=ruby -- --with-opt-lib=D:\ruby\Rmmagik\lib --with-opt-include=D:\ruby\Rmmagik\include Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
D:/ruby/bin/ruby.exe extconf.rb --with-opt-lib=D:\ruby\Rmmagik\lib --with-opt-include=D:\ruby\Rmmagik\include
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=D:/ruby/bin/ruby
Gem files will remain installed in D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Thanks in advance
Surjan
You're missing a header file.
It looks like you're on Windows, right?
If so, a simple solution may be to download the pre-built ImageMagick binary for Windows.
Link
If you're on Debian or Ubuntu:
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
(Editors, feel free to add solutions for other platforms)

Can't install RMagick 2.13.1. Can't find Magick-config

$ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin/ruby 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.1. Can't find Magick-config in /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/bin:/Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180#global/bin:/Users/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/XXXXXXX/.rvm/bin:/Users/XXXXXXX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/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=/Users/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
Gem files will remain installed in /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
But when I do this:
$ locate Magick-config
/opt/local/bin/Magick-config
/opt/local/share/man/man1/Magick-config.1.gz
/opt/local/var/macports/software/ImageMagick/6.6.4-9_0+q16/opt/local/bin/Magick-config
/opt/local/var/macports/software/ImageMagick/6.6.4-9_0+q16/opt/local/share/man/man1/Magick-config.1.gz
/opt/local/var/macports/software/ImageMagick/6.6.5-0_0+q16/opt/local/bin/Magick-config
/opt/local/var/macports/software/ImageMagick/6.6.5-0_0+q16/opt/local/share/man/man1/Magick-config.1.gz
Any ideas?
command: sudo apt-get install libmagickwand-dev
It isn't quite the answer to the question, but the recommended way of installing Imagemagick and Rmagick on Mac is through homebrew. It's the only way I could get Imagemagick and Rmagick playing nicely together on Mac.
For Ubuntu (11.10+) try installing the libmagick++-dev package.
For other Linux distributions, try installing the libmagick-dev package.
For my case, I am installing it on Ubuntu/Linaro 4.5.2-8ubuntu3, got same error, tried to installed the following two package suites and it worked, maybe either one of them:
sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install libmagickwand-dev
On mac, after
brew install imagemagick
Don't forget to link dylibs with:
brew link imagemagick
I had to transfer an old application to a debian stretch server.
The used ruby version was 2.0.x.
imagemagick was installed including libmagickwand-dev.
Trying to install rmagick 2.13.2 failed.
I had to upgrade the rmagick verion (patched my Gemfile.lock) to use rmagick 2.16.0, the last version supporting ruby 2.0.

Resources