views:

146

answers:

1

Hi guys , My Rmagic isn't work

ruby -v

ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]

rails -v

Rails 3.0.0.beta4

irb

require rubygems

true

require rmagick

true

but , I put the fllow code:

gem 'rmagick', :require => false

it error:

checking for Ruby version >= 1.8.5... 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=C:/Ruby/bin/ruby


Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `each'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in `install'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:100:in `install'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:55:in `run'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in `run'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:8:in `install'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in `install'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `send'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `run'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in `dispatch'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:in `start'
        from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/bin/bundle:13
        from C:/Ruby/bin/bundle:19:in `load'
        from C:/Ruby/bin/bundle:19

please help me , thanks !

+1  A: 

MagickWand.h is part of ImageMagick and the RMagick installer can't find it. It appears that you need to install ImageMagick on your system or if you have it installed you need to add the libraries to a path that the gem installer can see. RMagick will not work without ImageMagick or GraphicsMagick installed on your system.

UPDATED ANSWER Since you are using windows you will need to download the gem manually and install it. The installation FAQ says:

Use the rmagick-win32 gem. This gem is bundled with a a copy of the ImageMagick Windows installer so you don't need to download your own copy. Download the rmagick-win32 gem from the RMagick project page on RubyForge, unzip it into a temporary directory, and follow the instructions in the README.html file you'll find in the package.

http://rubyforge.org/projects/rmagick/

I am thinking that you probably want to uninstall the imagemagick version that you already installed, in case there are any conflicts. After you install the gem manually, you should be able to put it in your Gemfile and bundle install. Having not used rmagick on windows, I am not sure if you reference the gem as "rmagick" or "rmagick-win32". After you install the gem manually, you can probably figure that out by running the "gem list" command. See which one shows up and put that in your Gemfile, so it can find the installed version.. Bundler will use this gem instead of trying to install a new one.

cowboycoded
thanks cowboycoded, my os is Windows xp , I have installed ImageMagick-6.6.4-Q16 and add the libraries to a path . I not find MagickWand.h at C:\Program Files\ImageMagick-6.6.4-Q16 , Why?
kenny
please see updated answer. I am using rmagick on linux, but I think this should work for windows according to the install FAQ.
cowboycoded