7

I've done research on this and I've been at it on my one computer for hours and hours.

I've installed RMagick on my Desktop computer about 3 weeks ago, and it was fairly complicated.

I don't remember the exact steps I took, and I'm really frustrated.

I've installed ImageMagick onto my machine in the directory C:\ImageMagick

I've installed the Development kit too for Ruby.

I've also put the rmagick-rmagick-v2-2-g564f157 into the proper gems folder in my C: It's in C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems

I'm getting the following errors:

I will type: gem install rmagick -- '--with-opt-dir="c:\ImageMagick"'

and get the following errors:

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.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160326-6132-157vnes.rb extconf.rb
'--with-opt-dir="c:\ImageMagick"
checking for main() in -lCORE_RL_magick_... no
searching PATH for the ImageMagick library...
checking for main() in -lCORE_RL_magick_... no
checking for main() in -lCORE_RL_magick_... no
checking for main() in -lCORE_RL_magick_... no
Can't install RMagick 2.15.4.
Can't find the ImageMagick library.
Retry with '--with-opt-dir' option.
Usage: gem install rmagick -- '--with-opt-dir="[path to ImageMagick]"'
e.g.
  gem install rmagick -- '--with-opt-dir="C:Program FilesImageMagick-6.9.1-
Q16"'
*** 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:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
        --with-CORE_RL_magick_lib
        --without-CORE_RL_magick_lib
        --with-CORE_RL_magick_lib
        --without-CORE_RL_magick_lib
        --with-CORE_RL_magick_lib
        --without-CORE_RL_magick_lib
        --with-CORE_RL_magick_lib
        --without-CORE_RL_magick_lib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0
/gems/rmagick-2.15.4 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/rmagick-2.15.4/gem_make.out

I'm so frustrated at this point. It worked on my Desktop computer, but won't work here. Any suggestions?

Brian O
  • 109
  • 1
  • 9
  • Late at the party. Check out this [answer](http://stackoverflow.com/a/39513938/1903781) on how to install `rmagik` on windows 10. – Adrian Moisa Sep 15 '16 at 14:52

2 Answers2

8

This is the one link which can help you with all the issues you will ever face while installing rmagick gem.

Found it after a lot of browsing and after it you might not need any other link to visit.

link:- https://medium.com/ruby-on-rails-web-application-development/install-rmagick-gem-on-windows-7-8-10-imagemagick-6-9-4-q16-hdri-5492c3fef202

I hope it will save your time and efforts

Tim
  • 81
  • 1
  • 3
  • 3
    This should be the right answer IMO as it contains all information and steps necessary to get this working on Windows. – tiefenauer Jun 22 '18 at 06:52
  • I am getting errors on installation after following the above link tried 6.9.6 also 6.9.10 same errors https://pastebin.com/embed_iframe/6gMkPuNQ ERROR: Failed to build gem native extension. – dinu1389 Nov 29 '18 at 06:05
  • I am getting errors on installation after following the above link tried 6.9.6 also 6.9.10 same errors please refer to this  6.9.6 : https://pastebin.com/embed_js/Ukjbyhq9 6.9.10 : pastebin.com/embed_iframe/6gMkPuNQ ERROR: Failed to build gem native extension – dinu1389 Nov 29 '18 at 06:14
  • 1
    This answer totally deserves to be the right one. Fully solved my issue here. Thank you – Sergio A. Nov 06 '19 at 11:21
6

What I do to install is the following:

  1. Install ImageMagick with installer including (!) "development headers and libraries" See: http://www.graphity-consulting.com/files/2016/03/screenshot-installation-imagemagick-6.9.3-32bit-3.png
  2. Open windows command prompt
  3. Enhance path to include ImageMagick. E.g. set PATH=d:\opt\ImageMagick;%PATH%
  4. Install gem using: gem install rmagick -- --with-opt-dir=d:\opt\ImageMagick

Note: I let gem download rmagick by itself and I pass path to ImageMagick in --with-opt-dir and also have it in my path.

UPDATE:

As @winter-young mentioned in comments: Do not mix 32 Bit ruby with 64 Bit ImageMagick or vice versa. Only use 32 Bit ruby with 32 Bit ImageMagick. Or use 64 Bit ruby with 64 Bit ImageMagick.

UPDATE 2

As @winter-young states, rmagick 2.15.4 only supports ImageMagick 6, not ImageMagick 7 (didn't test it myself)

UPDATE 3

As @tiefenauer points out, rmagic 2.16.0 works with ImageMagick 7.0.8. Furthermore, single quotes are needed now: gem install rmagick -- '--with-opt-dir=C:\Program Files\ImageMagick-7.0.8-Q16'

Raul Pinto
  • 1,095
  • 8
  • 15
  • 2
    in my case, ld.exe failed to link a imagemagick library. I can't remember the library name. That was due to imagemagick 7 doesn't provide that library. I have to use imagemagick 6. if you use 64 bit ruby, you have to use 64 bit imagemagick. i used the 32 bit version. it failed again. – Winter Young Jul 02 '16 at 08:06
  • Good point, I update my answer to say don't mix 32Bit and 64Bit – Raul Pinto Jul 02 '16 at 14:19
  • 3
    Also, imagemagick 6, not 7. rmagic 2.15.4 only supports imagemagick 6. – Winter Young Jul 03 '16 at 05:30
  • @barlop I hadn't have the time to look into your issues, yet. But did you try Tim's answer below? – Raul Pinto Jan 23 '18 at 13:45
  • @barlop Please keep me updated. If Tim's version doesn't work, I can try my luck again – Raul Pinto Jan 25 '18 at 17:46
  • Thanks a lot! I was trying to install rmgick since weeks. You came to my rescue. This works perfectly. – Stuxen Jun 16 '18 at 13:23
  • 2
    I just installed rmagick 2.16.0 on Windows together with ImageMagick 7.0.8-Q16 and it works like a charm. I had to adjust the CLI command from Raul a bit: `gem install rmagick -- '--with-opt-dir=C:\Program Files\ImageMagick-7.0.8-Q16'` (note the single quotes around the _--with-opt-dir_ option). This was pointed out in the [installation instructions](https://github.com/rmagick-temp/rmagick/wiki/Installing-on-Windows). Looks like this version of Rmagick works with ImageMagick 7. – tiefenauer Jun 22 '18 at 06:12