quarta-feira, 2 de dezembro de 2009

Instalando ImageMagick e RMagick no Ubuntu 9.10

Em um projeto em Ruby on Rails, que utilizará o plugin FlexImage, precisei instalar a GEM rmagick. Logo percebi que deveria instalar alguns pacotes adicionais no Ubuntu, como ficou claro no erro, como segue:

Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for cc... yes
checking for Magick-config... no
Can't install RMagick 2.12.2. Can't find Magick-config in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

*** 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=/usr/bin/ruby1.8


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.12.2 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.12.2/ext/RMagick/gem_make.out


Então, parti para o famoso e salvador apt-get:
$ sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev

Em seguida, instalei a GEM:

$ sudo gem install rmagick

É isso. Espero que ajude alguém. Certamente poupará alguns preciosos minutos. ;-)

3 comentários:

  1. Cara instalar o rmagick no Ubuntu é muito mais fácil que isso. Basta instalar o pacote nativo librmagick-ruby e pronto. Sempre usei assim... não precisa compilar nada.

    ResponderExcluir
  2. Mergulhão, Comigo não funcionou. Fiz a instalação conforme sua recomendação:

    kosh@beren:~# sudo apt-get install librmagick-ruby
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
    librmagick-ruby1.8
    Suggested packages:
    librmagick-ruby-doc
    The following NEW packages will be installed:
    librmagick-ruby librmagick-ruby1.8
    0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Need to get 192kB of archives.
    After this operation, 680kB of additional disk space will be used.
    Do you want to continue [Y/n]?
    Get:1 http://br.archive.ubuntu.com karmic/universe librmagick-ruby1.8 2.10.0-1build1 [185kB]
    Get:2 http://br.archive.ubuntu.com karmic/universe librmagick-ruby 2.10.0-1build1 [7,044B]
    Fetched 192kB in 4s (38.8kB/s)
    Selecting previously deselected package librmagick-ruby1.8.
    (Reading database ... 216155 files and directories currently installed.)
    Unpacking librmagick-ruby1.8 (from .../librmagick-ruby1.8_2.10.0-1build1_i386.deb) ...
    Selecting previously deselected package librmagick-ruby.
    Unpacking librmagick-ruby (from .../librmagick-ruby_2.10.0-1build1_all.deb) ...
    Setting up librmagick-ruby1.8 (2.10.0-1build1) ...
    Setting up librmagick-ruby (2.10.0-1build1) ...
    kosh@beren:~#

    Em seguida:

    kosh@beren:~# sudo gem install rmagick
    Building native extensions. This could take a while...
    ERROR: Error installing rmagick:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.8 extconf.rb
    checking for Ruby version >= 1.8.5... yes
    checking for gcc... yes
    checking for Magick-config... no
    Can't install RMagick 2.12.2. Can't find Magick-config in /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
    --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=/usr/bin/ruby1.8


    Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.12.2 for inspection.
    Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.12.2/ext/RMagick/gem_make.out
    kosh@beren:~#

    Só consegui resolver fazendo como está no post. A roda um Ubuntu 9.10 recém instalado: Foi instalado o ruby, o rubygems via arquivo tar e depois o rails.

    O que terá faltado?

    []'s

    ResponderExcluir
  3. Valeu amigo, ajudou bastante aqui nem acredito so faltavam os pacotes core e dev xD abraço

    ResponderExcluir