68

I am having issue while trying to install "rmagick" gem on centos. Following is the output I am having. Can anyone please help me identifying what package I am missing? I have installed all mentioned another stack-overflow thread: RMagick install error

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

        /usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... 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 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 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 containing `MagickCore.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.2. 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/bin/ruby


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

After following suggestions, now I am getting this output:

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

        /usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for 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... *** 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
/usr/local/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
    from extconf.rb:194:in `<main>'


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

Output Of mkmf.log:

checking for HDRI disabled version of ImageMagick... -------------------- yes

--------------------

"gcc -o conftest -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I.  -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6    -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6   conftest.c  -L. -L/usr/local/lib -Wl,-R/usr/local/lib  -L/usr/lib -lMagickCore-6.Q16      -L/usr/lib -lMagickCore-6.Q16    -Wl,-R -Wl,/usr/local/lib -L/usr/local/lib -lruby-static  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: cannot find -lMagickCore-6.Q16
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"

Output of gem_make.out is same as the terminal output above.

Community
  • 1
  • 1
Rana
  • 5,912
  • 12
  • 58
  • 91

8 Answers8

140

try installing

  sudo apt-get install libmagickwand-dev imagemagick
Sachin Singh
  • 7,107
  • 6
  • 40
  • 80
38

This ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h works for Rmagick 2.16.

brew install imagemagick@6
brew link --force imagemagick@6
gem install rmagick
Gus
  • 90
  • 1
  • 9
mmell
  • 2,448
  • 1
  • 24
  • 16
18

The error message says:

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

It seems you missing no package at all, you just have to tell pkg-config where to find the MagickCore.pc file to build the extension. If you have installed the package ImageMagick-devel using yum the file should be inside the directory /usr/lib/pkgconfig or /usr/lib64/pkgconfig (depending on your architecture). Check with this command (from now I assume you are on a amd64 machine, if it's not the case replace lib64 with lib):

$ find /usr/lib64/pkgconfig -name MagickCore.pc

If the file is there you just have to install rmagick with this command:

$ PKG_CONFIG_PATH='/usr/lib64/pkgconfig' gem install rmagick
toro2k
  • 19,020
  • 7
  • 64
  • 71
  • Thanks. your suggestion worked. However, I am getting another output now(please check the edited question details). I am not sure what to do with the "Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details." . Also, do I need to install the development versions mentioned in the output? – Rana May 27 '13 at 15:12
  • Hi, yes, I just confirmed that do have this glibc-headers lib installed. any other clue? – Rana May 27 '13 at 19:44
  • added the output of mkmf.log file above. Please check if you can find any clue. I am new at these and linux too, so a lot lost, outputs are less meaningful to me :( . Also, if you can give me a descriptive guide link to install RMagick that I can follow from start again, it will be of great help too. – Rana May 28 '13 at 09:47
  • no, I didn't compiled any package from source. I have always installed the packaged libraries either using "yum install" or "gem install" . The answer on this question: http://stackoverflow.com/questions/14355798/gem-install-error-with-rmagick?rq=1 , do you think that can be a similar case for me too? incompatible version of rmagick with imagemagick? – Rana May 28 '13 at 14:35
  • 1
    On Ubuntu 16.04 this is now PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig gem install rmagick -v '2.13.2' – werkshy Mar 18 '16 at 15:13
8

The problem is, as the error puts it,

Package MagickCore was not found in the pkg-config search path

The solution is also suggested there:

add the directory containing MagickCore.pc to the PKG_CONFIG_PATH environment variable

So,

  1. Find MagickCore.pc location:

    sudo find / -name MagickCore.pc
    
  2. If it is not found, probably ImageMagick is not installed on your system — then install it (Google how to do it, as it depends on the OS)

  3. Save it to the ENV var like that (make sure to put the path found in step 1):

    PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
    
  4. Retry installing RMagick

Sergey Pedan
  • 179
  • 1
  • 7
7

For Mac with Brew, simply..

brew install imagemagick

Then gem install imagemagick will work smoothly.

Fadils
  • 1,508
  • 16
  • 21
3

It doesn't look like you're missing any packages. The error message is important:

Perhaps you should add the directory containing `MagickCore.pc' to the PKG_CONFIG_PATH environment variable

Several of the answers on this superuser duplicate give good advice.

Community
  • 1
  • 1
Darshan Rivka Whittle
  • 32,989
  • 7
  • 91
  • 109
1

On debian (unstable) the correct packages needed to resolve this error were libmagickcore-6.q16-dev, imagemagick and libmagickwand-6-headers

I found them by using apt-file search MagickCore.pc and apt-file search MagickWand.h

Spikolynn
  • 4,067
  • 2
  • 37
  • 44
0

For windows users who run into this, and are 100% psotive that they have the devkit installed:

When installing, you will be presented this prompt enter image description here

Choosing 1 is not enough. Just press enter (1 & 3) and that will install the devkit properly.

adnan_e
  • 1,764
  • 2
  • 16
  • 25