splunk
splunk

Reputation: 6789

gem install rmagick error

I know there are many questions about this error but I read several tutorials and SO discussions without coming to a solution.

I'm trying to install rmagick (I want to install Spree ecommerce for Ruby on Rails which requires ImageMagick and rmagick).

I'm working on Windows 7 (64 bit), Ruby version is: 2.1.5, Rails version is 4.2.1. and I downloaded and installed (in C:\ImageMagick) ImageMagick-6.9.1-2-Q16-x64-dll.exe and I also installed Dev-Kit.

I followed the steps that Sumit Munot suggested here ImageMagick Install Windows but when I follow the step 6 I get this errors.

C:\Sites>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/Ruby2.1.0/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for stdint.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:/RailsInstaller/Ruby2.1.0/bin/ruby
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler
 failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'

        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:1067:in `block i
n have_header'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:918:in `block in
 checking_for'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block (2
 levels) in postpone'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block in
 postpone'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:347:in `postpone
'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:917:in `checking
_for'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:1066:in `have_he
ader'
        from extconf.rb:37:in `configure_headers'
        from extconf.rb:17:in `initialize'
        from extconf.rb:474:in `new'
        from extconf.rb:474:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1
.0/gems/rmagick-2.15.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86
-mingw32/2.1.0/rmagick-2.15.0/gem_make.out

C:\Sites>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/Ruby2.1.0/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for stdint.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:/RailsInstaller/Ruby2.1.0/bin/ruby
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler
 failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'

        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:1067:in `block i
n have_header'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:918:in `block in
 checking_for'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block (2
 levels) in postpone'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block in
 postpone'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:347:in `postpone
'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:917:in `checking
_for'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:1066:in `have_he
ader'
        from extconf.rb:37:in `configure_headers'
        from extconf.rb:17:in `initialize'
        from extconf.rb:474:in `new'
        from extconf.rb:474:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1
.0/gems/rmagick-2.15.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86
-mingw32/2.1.0/rmagick-2.15.0/gem_make.out

This is my path: C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby2.1.0\bin;C:\Ruby21\bin; Do I have to add something to the path?

Upvotes: 3

Views: 1468

Answers (2)

peter
peter

Reputation: 42192

Yeah, had the same trouble and gave it a second shot.

  • Remove your current ImageMagic folder and rmagick gem
  • Install ImageMagick-6.7.9-3-Q16-windows-dll.exe from here and ImageMagick-6.7.9-2-Q8-windows-static.exe in the same folder (these worked while the most recent ones don't)
  • in your console window set path=d:\ImageMagick;%path%
  • gem install rmagick -- '--with-opt-dir="d:\ImageMagick"'

I installed ImageMagick obviously in d:\ImageMagick, so adapt for your situation. This worked for my Ruby 1.9.3 under Windows 7, success !

Upvotes: 1

Suriyaa
Suriyaa

Reputation: 2286

Set %DEVKIT_HOME%\bin in your %PATH% in the System Variables:

enter image description here

Upvotes: 0

Related Questions