Gem install rmagick requires imagemagick

I was trying to just do a CLI short (very short) script with activerecord
and sqlite3, and in tracing back some errors ended at:

thufir@dur:~$
thufir@dur:~$ gem search rmagic -r

*** REMOTE GEMS ***

compass-rmagick-engine (0.0.2)
hornetseye-rmagick (0.5.0)
jdeerhake-compass-rmagick-engine (0.0.3)
rdp-rmagick (0.0.0)
rmagick (2.13.1)
rmagick4j (0.3.7, 0.3.4 java)
rmagick_captcha (0.6.2)
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ gem install rmagick --no-rdoc --no-ri
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
  ERROR: Failed to build gem native extension.

        /home/thufir/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /home/
thufir/.rvm/gems/ruby-1.9.3-p125/bin:/home/thufir/.rvm/gems/ruby-1.9.3-
p125@global/bin:/home/thufir/.rvm/rubies/ruby-1.9.3-p125/bin:/opt/
ActiveTcl-8.5/bin:/home/thufir/.rvm/gems/ruby-1.9.3-p125/bin:/home/
thufir/.rvm/gems/ruby-1.9.3-p125@global/bin:/home/thufir/.rvm/rubies/
ruby-1.9.3-p125/bin:/home/thufir/.rvm/bin:/usr/lib/lightdm/lightdm:/usr/
local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

*** 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=/home/thufir/.rvm/rubies/ruby-1.9.3-p125/bin/ruby

Gem files will remain installed in /home/thufir/.rvm/gems/ruby-1.9.3-p125/
gems/rmagick-2.13.1 for inspection.
Results logged to /home/thufir/.rvm/gems/ruby-1.9.3-p125/gems/
rmagick-2.13.1/ext/RMagick/gem_make.out
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ type rvm | head -1
rvm is a function
thufir@dur:~$
thufir@dur:~$ rvm --version

rvm 1.10.3 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis
<mpapis@gmail.com> [https://rvm.beginrescueend.com/]

thufir@dur:~$
thufir@dur:~$ ruby --version
ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]
thufir@dur:~$
thufir@dur:~$ gem --version
1.8.19
thufir@dur:~$

Now, it looks like I just use apt-get to install imagemagick on Ubuntu
11.10, but that seems off, in that gems should be system independent, to
my understanding.

This gem requires that I install a non-gem piece of software?

thanks,

Thufir

Similar but different result for another gem:

thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ whereis curl
curl: /usr/bin/curl /usr/share/man/man1/curl.1.gz
thufir@dur:~$
thufir@dur:~$ gem install feedzirra --no-rdoc --no-ri
Building native extensions. This could take a while...
ERROR: Error installing feedzirra:
  ERROR: Failed to build gem native extension.

        /home/thufir/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for curl-config... no
checking for main() in -lcurl... no
*** 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=/home/thufir/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
  --with-curl-dir
  --without-curl-dir
  --with-curl-include
  --without-curl-include=${curl-dir}/include
  --with-curl-lib
  --without-curl-lib=${curl-dir}/lib
  --with-curllib
  --without-curllib
extconf.rb:23:in `<main>': Can't find libcurl or curl/curl.h
(RuntimeError)

  Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
  options to extconf.

Gem files will remain installed in /home/thufir/.rvm/gems/ruby-1.9.3-p125/
gems/curb-0.7.18 for inspection.
Results logged to /home/thufir/.rvm/gems/ruby-1.9.3-p125/gems/curb-0.7.18/
ext/gem_make.out
thufir@dur:~$
thufir@dur:~$

Sigh. Do I have to re-install ruby or something? Or are these gems the
problem? Seems more likely that my computer is, though.

-Thufir

···

On Thu, 22 Mar 2012 21:44:18 +0900, thufir wrote:

thufir@dur:~$ gem install rmagick --no-rdoc --no-ri Building native
extensions. This could take a while... ERROR: Error installing
rmagick:
  ERROR: Failed to build gem native extension.

If the purpose of a gem is to interface with another program, then
yes, you need that program (or typically some of it's source libraries)
on your system.

"Building native extensions." is a pretty good clue that a gem isn't
pure Ruby, e.g. "system independent" :slight_smile:

In this case, perhaps this will help:
<http://rmagick.rubyforge.org/install-faq.html&gt;

HTH,

···

On Thu, Mar 22, 2012 at 5:44 AM, thufir <hawat.thufir@gmail.com> wrote:

Now, it looks like I just use apt-get to install imagemagick on Ubuntu
11.10, but that seems off, in that gems should be system independent, to
my understanding.

This gem requires that I install a non-gem piece of software?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

twitter: @hassan

sudo apt-get install libmagickcore-dev libcurl4-dev

···

On Thu, Mar 22, 2012 at 4:57 PM, thufir <hawat.thufir@gmail.com> wrote:

On Thu, 22 Mar 2012 21:44:18 +0900, thufir wrote:

> thufir@dur:~$ gem install rmagick --no-rdoc --no-ri Building native
> extensions. This could take a while... ERROR: Error installing
> rmagick:
> ERROR: Failed to build gem native extension.

Similar but different result for another gem:

thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ whereis curl
curl: /usr/bin/curl /usr/share/man/man1/curl.1.gz
thufir@dur:~$
thufir@dur:~$ gem install feedzirra --no-rdoc --no-ri
Building native extensions. This could take a while...
ERROR: Error installing feedzirra:
        ERROR: Failed to build gem native extension.

       /home/thufir/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for curl-config... no
checking for main() in -lcurl... no
*** 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=/home/thufir/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
        --with-curl-dir
       --without-curl-dir
       --with-curl-include
       --without-curl-include=${curl-dir}/include
       --with-curl-lib
       --without-curl-lib=${curl-dir}/lib
       --with-curllib
       --without-curllib
extconf.rb:23:in `<main>': Can't find libcurl or curl/curl.h
(RuntimeError)

Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.

Gem files will remain installed in /home/thufir/.rvm/gems/ruby-1.9.3-p125/
gems/curb-0.7.18 for inspection.
Results logged to /home/thufir/.rvm/gems/ruby-1.9.3-p125/gems/curb-0.7.18/
ext/gem_make.out
thufir@dur:~$
thufir@dur:~$

Sigh. Do I have to re-install ruby or something? Or are these gems the
problem? Seems more likely that my computer is, though.

-Thufir

Thanks, guys. Almost seventy packages getting pulled in! Hopefully,
that will fix it.

Success!

thufir@dur:~$
thufir@dur:~$ gem install rmagick --no-rdoc --no-ri
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ sudo find / -type f -name "MagickWand.h"
[sudo] password for thufir:
/usr/include/ImageMagick/wand/MagickWand.h
thufir@dur:~$

I also had to install ImageMagick itself for MagicWand.h which was
holding things up. Basically, anything with "magick" I installed.

Kinda forget why I wanted that gem, now, LOL. Something to do with
ActiveRecord.

-Thufir