0

I am trying to install the rmagick gem from https://github.com/rmagick/rmagick to use with the carrierwave gem https://github.com/carrierwaveuploader/carrierwave for image uploads.

I am following the railscast http://railscasts.com/episodes/253-carrierwave-file-uploads and can't get images to display through the an index page in my app.

I need to install rmagick for image resizing but get the following error when running bundle command with the following declared in my gem file: gem 'rmagick', '2.13.2'. Has anyone got any suggestions for resolving the error? Thanks in advance guys:

Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.0)
Using bcrypt-ruby (3.1.2)
Using debug_inspector (0.0.2)
Using binding_of_caller (0.7.2)
Using sass (3.2.12)
Using bootstrap-sass (3.0.2.0)
Using bundler (1.3.4)
Using carrierwave (0.6.2)
Using climate_control (0.0.3)
Using cocaine (0.5.3)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.1)
Using columnize (0.3.6)
Using debugger-linecache (1.2.0)
Using debugger-ruby_core_source (1.2.4)
Using debugger (1.6.2)
Using orm_adapter (0.4.0)
Using warden (1.2.3)
Using devise (3.1.1)
Using hike (1.2.3)
Using jbuilder (1.5.2)
Using jquery-rails (3.0.4)
Using jquery-ui-rails (4.1.1)
Using json (1.8.1)
Using paperclip (3.5.2) from git://github.com/thoughtbot/paperclip.git (at maste
r)
Using protected_attributes (1.0.3)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.1)
Using rails (4.0.0)
Using rdoc (3.12.2)
Installing rmagick (2.13.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.

        C:/RailsInstaller/Ruby1.9.3/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/Ruby1.9.3/bin/ruby
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler
 failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'

        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:931:in `block in
 have_header'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:790:in `block in
 checking_for'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block (2
 levels) in postpone'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block in
 postpone'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `postpone
'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:789:in `checking
_for'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:930:in `have_hea
der'
        from extconf.rb:194:in `<main>'


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/rmagick-2.13.2 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rmagick-2
.13.2/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
Joshua
  • 371
  • 2
  • 6
  • 23
  • how did you install ruby and the like? perhaps this question can help http://stackoverflow.com/questions/6473853/ruby-on-rails-rmagick-on-windows-7 – Doon Jan 31 '14 at 16:10

1 Answers1

2

It appears you haven't installed the ruby DevKit for windows package - see here for info on this. You will also need to install ImageMagick before you attempt to install the RMagick gem (you did that right?).

There is also a gem MiniMagick which will give you similar functionality within Carrierwave as RMagick, and I've found it to use less of a memory footprint. And it has the added benefit that it doesn't need to build native extensions (so you can skip DevKit for this).

PinnyM
  • 35,165
  • 3
  • 73
  • 81
  • I just installed MiniMagick, do you think it will work in the same way that RMagick is used in the railscast Iam following: http://railscasts.com/episodes/253-carrierwave-file-uploads, would I need to use a different method? – Joshua Jan 31 '14 at 19:15
  • See the carrierwave documentation and wiki - it should clarify any questions you ave. – PinnyM Jan 31 '14 at 19:52