问题
Windows Vista, Ruby v. 3.3.5
C:\>gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
C:/Ruby19/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:/Ruby19/bin/ruby
Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/rmagick-2.
12.2 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/rmagick-2.12.2/ext/RMagick/
gem_make.out
回答1:
On Windows, you should use the rmagick-win32 gem.
http://rmagick.rubyforge.org/install-faq.html#win
回答2:
You can get rmagick to compile on Windows with the command:
gem install rmagick -- '--with-opt-dir="[path to ImageMagick]"'
There are three noteworthy things about this command:
- There's a double-dash separating "rmagick" and the --with-opt-dir option
- The --with-opt-dir option is surrounded by single-quotes
- The path to the ImageMagick directory is surrounded by double-quotes
You can have spaces in the path to the ImageMagick directory if you use this syntax. I think the path also doesn't care about forward or backward slashes, but I use backslashes.
You also have to make sure of two other things:
- ImageMagick was installed with the development headers option (installs lib and include directories)
- ImageMagick is first in your system path
If ImageMagick isn't first in your system path, you'll get an "Invalid drive specification" error when extconf.rb tries to identify the ImageMagick version.
All that said, I've experienced failures to build with some version pairings of rmagick and ImageMagick. I was able to get ImageMagick 6.7.7 and rmagick 2.13.1 to build together on both Windows 7 and Server 2003.
回答3:
Download this rmagick-2.13.2.gem gem and save in you local.
Open the repository in cmd prompt where the gem file is located and run the following cmd
gem install rmagick-2.13.2.gem --platform=ruby --with-opt-lib=C:/ImageMagick-6.6.7-Q16/lib --with-opt-include=c:/ImageMagick-6.6.7-Q16/include
回答4:
A simple google search yielded one very promising result: rmagick on windows. By the way, I guess you are using something like Ruby 1.8.5/1.8.7, but surely not 3.3.5 ( if you do, please let me join you in your time-travel adventures. We could be friends! )
来源:https://stackoverflow.com/questions/1972321/wont-let-me-install-gem-in-ruby-prompt