4
votes

I am trying to install RmMagic using the below command:

gem install rmagick -v=2.12.2

After running this command i get some error :

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
checking for Ruby version >= 1.8.5... yes
Invalid drive specification.
Unable to get ImageMagick version
*** 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=D:/ruby/bin/ruby


Gem files will remain installed in D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2
.12.2 for inspection.
Results logged to D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.12.2/ext/RMagick
/gem_make.out

Please help me in this regard. Thanks in advance.

2

2 Answers

3
votes

I had same problem with rmagick to solve this add System Environment Variable

CLASSPATH .;C:\ImageMagick-6.5.6-Q8\include

lib C:\ImageMagick-6.5.6-Q8\lib

Then do

gem install rmagick  --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.5.6-Q8\lib --with-opt-include=C:\ImageMagick-6.5.6-Q8\include
0
votes

What a pain this was... I definitely needed to do both the System Environment Variables AND the specific syntax of the command as suggested by Mukesh

To clarify the two steps:(for other novices like me)

Click properties from context menu of "Computer, click "Advanced System Settings", click "Environment Variables", click "New" under System Variables,

use CLASSPATH for the variable name and for the value use:

.;C:\ImageMagick-6.9.0-Q16\include;lib C:\ImageMagick-6.9.0-Q16\lib

Then Run As Administrator the Command Prompt with Ruby terminal and execute:

gem install rmagick -v '2.13.4' -- --with-opt-lib=C:\ImageMagick-6.9.0-Q16\lib --with-opt-include=C:\ImageMagick-6.9.0-Q16\include

(***Make sure to update the versions number in both the Variable and gem command if necessary)