How to install rmagick gem on Windows?-Collection of common programming errors


  • Chloe

    How do I install rmagick gem for Windows XP? I already installed ImageMagick with the header files, and I installed RailsInstaller.org which comes with DevKit. I don’t know where to look to fix these errors.

    C:\RailsInstaller\ImageMagick-6.8.2-Q16>ruby -v
    ruby 1.9.3p125 (2012-02-16) [i386-mingw32]
    
    C:\RailsInstaller\ImageMagick-6.8.2-Q16>gem -v
    1.8.16
    
    C:\RailsInstaller\ImageMagick-6.8.2-Q16>path=%PATH%;C:\RailsInstaller\ImageMagick-6.8.2-Q16
    
    C:\RailsInstaller\ImageMagick-6.8.2-Q16>identify
    Version: ImageMagick 6.8.2-0 2013-01-24 Q16 http://www.imagemagick.org
    Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
    
    C:\RailsInstaller\ImageMagick-6.8.2-Q16>gem install rmagick
    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.
            C:/RailsInstaller/Ruby1.9.3/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=C:/RailsInstaller/Ruby1.9.3/bin/ruby
    
    
    Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1 for inspection.
    Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rmagick-2    .13.1/ext/RMagick/gem_make.out
    
    
    
    C:\RailsInstaller\ImageMagick-6.8.2-Q16>dir include
     Volume in drive C has no label.
     Volume Serial Number is F8E5-EDB8
    
     Directory of C:\RailsInstaller\ImageMagick-6.8.2-Q16\include
    
    01/29/2013  04:33 PM              .
    01/29/2013  04:33 PM              ..
    01/29/2013  04:33 PM              magick
    01/29/2013  04:33 PM              Magick++
    09/05/2009  04:47 PM               419 Magick++.h
    01/29/2013  04:33 PM              wand
    

    Here is the contents of gem_make.out

    C:/RailsInstaller/Ruby1.9.3/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=C:/RailsInstaller/Ruby1.9.3/bin/ruby
    

    Here is the contents of extconf.rb

    require "mkmf"
    require "date"
    
    RMAGICK_VERS = "2.13.1"
    MIN_RUBY_VERS = "1.8.5"
    MIN_RUBY_VERS_NO = MIN_RUBY_VERS.tr(".","").to_i
    MIN_IM_VERS = "6.4.9"
    MIN_IM_VERS_NO = MIN_IM_VERS.tr(".","").to_i
    
    
    
    # Test for a specific value in an enum type
    def have_enum_value(enum, value, headers=nil, &b)
      checking_for "#{enum}.#{value}" do
        if try_compile(