简体   繁体   中英

Install ImageMagick and rmagick on Windows 7

I am trying to install ImageMagick and a ruby library binding for it called rmagick onto a windows machine to use with rails + paperclip. I am currently running windows 7. I have set up the rails environment for the windows machine using the rails installer, if that helps.

I have tried many different resources including these:

redmine

rmagick wiki

tutorial

and i am still getting this error

Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-opt-dir="C:\ImageMagick"'
This could take a while...
ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

   current directory: C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rmag
ick-2.16.0/ext/RMagick
C:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20170112-3020-wa31th.rb ex
tconf.rb --with-opt-dir="C:\ImageMagick"
*** 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
        --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/Ruby2.2.0/bin/$(RUBY_BASE_NAME)
extconf.rb:141:in ``': No such file or directory - identify -version (Errno::ENO
ENT)
        from extconf.rb:141:in `configure_compile_options'
        from extconf.rb:16:in `initialize'
        from extconf.rb:548:in `new'
        from extconf.rb:548:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2
.0/gems/rmagick-2.16.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/extensions/x86
-mingw32/2.2.0/rmagick-2.16.0/gem_make.out

Here is a list of things I have done:

  • downloaded the image magick binaries
  • installed with path option, and set the C and C++ headers
  • added the proper paths (referred to in the wiki) pointing to the download
  • installed the rmagick gem pointing towards the binary download

Has anyone sucessfully installed imagemagick on windows? I may or may not need to use the rmagick gem, as it's just a binding for it, but it seemed like a better option that just the raw download.

If anyone has successfully accomplished this, I would be very appreciative of any help.

It's also worth noting, I am not tied to Paperclip + Imagemagick, if there is another library that works on windows for this I am happy to use that as well.

I have installed it. You will need to install Ruby Devkit.
https://rubyinstaller.org/downloads/

It was very tedious process so I made notes for a client. Steps are mislabelled because it includes installing git and ruby first. I would use more recent instructions on websites if available.

I think that ImageMagick needed to be version 6, not sure.

Here are the notes:

3. Install devkit

Same link http://rubyinstaller.org/
Download and extract to C:\\RubyDevkit

Follow steps 3.1 and 3.2 if you downloaded DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

For other versions, if you are getting error messages then use instructions from http://rubyinstaller.org/
which used to link to this document: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

3.1. Entire DevKit procedure at a glance
  • Download matching version (from http://rubyinstaller.org/ )
  • Uninstall previous version if it exists.
  • Extract to C:\\RubyDevKit

You need to open CMD.exe (do not use git bash) to C:\\RubyDevKit and type these commands.

 cd C:\\RubyDevKit ruby dk.rb init ruby dk.rb install devkitvars.bat 

4. Install imagemagick

If your ruby is 32 bit, install 32 bit otherwise 64 bit.
What works for sure is ImageMagick-6.7.3-4-Q16-windows-dll.exe

Don't install in Program Files because 3rd party scripts might have problems with spaces.

Install in C:\\ImageMagick so that you can copy paste commands later

Make sure these options are checked

  • Add application directory to your system path
  • Install development headers and libraries for C and C++

5. Install rmagick gem

Just running bundle install fails because it requires more options.

Run this from anywhere in cmd.exe
To open cmd.exe open Start Menu and under Search programs and files type cmd.exe

echo %LIBRARY_PATH%

Unfortunately these commands give no visual feedback like OK. To get feedback you can type this:

gem install rmagick -- '--with-opt-dir="C:\ImageMagick"'

And you should get output "C:\\ImageMagick\\include"

gem list

And you should get output "C:\\ImageMagick\\lib"

 gem install rmagick -- '--with-opt-dir="C:\\ImageMagick"' 

You should get a success message. You can verify if gem is installed by typing

 gem list 

It should list rmagick.

Try this first, but in case this doesn't work, look up more current instructions on:
https://github.com/rmagick/rmagick/wiki/Installing-on-Windows

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM