Ubuntu 12.10 - проблема с ошибкой Ruby gem rmagick

Как и многие другие, у меня возникли проблемы с установкой rmagick на Ubuntu при запуске установки пакета.

Я получаю эту ошибку в команде установки пакета:

Installing rmagick (2.13.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.8.7-p371/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /usr/local/rvm/gems/ruby-1.8.7-p371/bin:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-1.8.7-p371/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/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/local/rvm/rubies/ruby-1.8.7-p371/bin/ruby


Gem files will remain installed in /home/selfsale/.bundler/tmp/2908/gems/rmagick-2.13.1 for inspection.
Results logged to /home/selfsale/.bundler/tmp/2908/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

An error occurred while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.

Затем я сделал несколько поисков и нашел несколько предложений по добавлению недостающих библиотек:

sudo apt-get install libmagick9-dev:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libmagick9-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  graphicsmagick-libmagick-dev-compat

E: Package 'libmagick9-dev' has no installation candidate

sudo apt-get install graphicsmagick-libmagick-dev-compat:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 graphicsmagick-libmagick-dev-compat : Depends: libgraphicsmagick1-dev but it is not going to be installed
                                       Depends: libgraphicsmagick++1-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt-get install libmagickwand-dev:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libmagickwand-dev : Depends: libmagickcore-dev (= 8:6.6.9.7-5ubuntu3.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt-get install libmagickcore-dev:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libmagickcore-dev : Depends: libbz2-dev but it is not going to be installed
                     Depends: libfreetype6-dev but it is not going to be installed
                     Depends: libpng-dev
                     Depends: librsvg2-dev but it is not going to be installed
                     Depends: libwmf-dev but it is not going to be installed
                     Depends: libx11-dev but it is not going to be installed
                     Depends: libxext-dev but it is not going to be installed
                     Depends: libxt-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt-get install libmagick ++ - dev:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libmagick++-dev : Depends: libmagickcore-dev (= 8:6.6.9.7-5ubuntu3.2) but it is not going to be installed
                   Depends: libmagickwand-dev (= 8:6.6.9.7-5ubuntu3.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Кажется, что любая попытка установить правильные пакеты устраняет эту проблему.

Я только что видел сообщение об установке imagemagick из источника, поэтому я собираюсь попробовать это, но если у кого-то есть лучшие идеи, я бы хотел их услышать.

Спасибо

Ответ 1

Я нашел решение:

sudo apt-get install aptitude

Затем огонь:

sudo aptitude install graphicsmagick-libmagick-dev-compat

Когда его спросят:

The following actions will resolve these dependencies:
 Keep the following packages at their current version
1)     graphicsmagick-libmagick-dev-compat [Not Installed]
2)     libexif-dev [Not Installed]
3)     libgraphicsmagick++1-dev [Not Installed]
4)     libgraphicsmagick1-dev [Not Installed]

Ответ: "n"

Accept this solution? [Y/n/q/?] n

Во втором вопросе:

The following actions will resolve these dependencies:

 Downgrade the following packages: 
1) libexif12 [0.6.20-2ubuntu0.1 (now) -> 0.6.20-2 (precise)] 

Ответ: "Y" или нажмите ENTER

Accept this solution? [Y/n/q/?]

Дождитесь окончания задачи;)

Ответ 2

Я просто попробовал на своем ноутбуке (Ubuntu 13.04).

gem install rmagick

тоже не удалось. Тогда я сделал

sudo apt-get install libmagick++-dev

и rmagick установлены без проблем.

Ответ 3

Это решение все более важно, чем показано выше, потому что оно удаляет:

graphicsmagick-libmagick-dev-compat

но решает проблему с (в 'bundle install'):

checking for wand/MagickWand.h... no

как показано в моем втором типе сообщения в приглашении:

sudo aptitude install libmagickwand-dev

В:

The following actions will resolve these dependencies:

  Keep the following packages at their current version
1)      libatk1.0-dev [Not Installed]
2)      libcairo2-dev [Not Installed]
3)      libexpat1-dev [Not Installed]
4)      libgdk-pixbuf2.0-dev [Not Installed]
5)      libglib2.0-dev [Not Installed]
6)      libgraphviz-dev [Not Installed]
7)      libgtk2.0-dev [Not Installed]
8)      libmagickcore-dev [Not Installed]
9)      libmagickwand-dev [Not Installed]
10)     libpango1.0-dev [Not Installed]
11)     librsvg2-dev [Not Installed]

Ответ:

Accept this solution? [Y/n/q/?] n

В отключении:

Следующие действия разрешат эти зависимости:

  Remove the following packages: 
1 ) graphicsmagick-libmagick-dev-compat
Install the following packages:
2)libcairo-script-interpreter2 [1.10.2-6.1ubuntu2 (precise)]
[..]

Ответ: "Y"

Accept this solution? [Y/n/q/?]

После выполнения задачи U может легко запустить 'bundle install' в каталоге проекта.

Ответ 4

Попробуйте установить imagemagick и libmagickwand-dev вместе:

sudo apt-get install imagemagick libmagickwand-dev

Это позволяет apt корректно разрешать зависимости. (проверено на Ubuntu 12.04)

Ответ 5

sudo apt-get install libmagick++-dev
Успех

rmagick