【问题标题】:An error occurred while installing rmagick (2.13.2), and Bundler cannot continue [duplicate]安装 rmagick (2.13.2) 时出错,Bundler 无法继续 [重复]
【发布时间】:2014-02-20 08:02:25
【问题描述】:

使用 gem magick' 并且正在使用 rails 3.1.0

Fetching gem metadata from http://rubygems.org/.........

Fetching additional metadata from http://rubygems.org/..

Resolving dependencies...


Using rake (10.1.1)
Using multi_json (1.8.4)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.1)
Using builder (3.0.4)
Using i18n (0.6.9)
Using activemodel (3.1.0)
Using erubis (2.7.0)
Using rack (1.3.10)
Using rack-cache (1.0.3)
Using rack-mount (0.8.3)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.3.7)
Using sprockets (2.0.4)
Using actionpack (3.1.0)
Using mime-types (1.25.1)
Using polyglot (0.3.4)
Using treetop (1.4.15)
Using mail (2.3.3)
Using actionmailer (3.1.0)
Using arel (2.2.3)
Using tzinfo (0.3.38)
Using activerecord (3.1.0)
Using activeresource (3.1.0)
Using ansi (1.4.3)
Using bundler (1.5.2)
Using carrierwave (0.5.8)
Using coffee-script-source (1.7.0)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Using json (1.8.1)
Using rdoc (3.12.2)
Using thor (0.14.6)
Using railties (3.1.0)
Using coffee-rails (3.1.1)
Using jquery-rails (3.1.0)
Using mysql2 (0.3.15)
Using rails (3.1.0)


Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.


        /usr/bin/ruby1.9.1 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.2. Can't find Magick-config in /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
    --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.9.1


Gem files will remain installed in /home/rithujadav/.bundler/tmp/3624/gems/rmagick-2.13.2 for inspection.

Results logged to /home/rithujadav/.bundler/tmp/3624/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.

【问题讨论】:

  • 你在安装包之前尝试过 gem install rmagick
  • sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
  • 在@RaghvendraParasha 的回答之后,运行gem install rmagick

标签: ruby-on-rails


【解决方案1】:

你应该先安装 ImageMagick:

sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev

【讨论】:

  • 我必须安装 libmagickwand-dev 才能使其工作。谢谢:)
【解决方案2】:

在 Mac 上,我使用了 brew install imagemagick

这让我可以顺利运行gem install rmagick -v '2.13.2'

【讨论】:

  • 也适用于 2.15.4。
  • 自制 FTW!!!
【解决方案3】:

试试

$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

$ export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"

然后$ gem install rmagick 应该可以工作

【讨论】:

  • 这是我在 16.04 所做的,sudo apt-get install libmagickwand-dev sudo apt-get install graphicsmagick-imagemagick-compat PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8 .9/bin-Q16:$PATH" gem install rmagick -v '2.13.2'
  • @JamesMaynard,非常感谢,导出 PATH 帮助了我。但是,我没有像这样直接在命令行中输入 PATH 以避免覆盖其他路径,而是将其添加到 .bashrc 中,如下所述:askubuntu.com/a/60219/329695
猜你喜欢
  • 1970-01-01
  • 2019-06-18
  • 2014-11-04
  • 2013-03-11
  • 2016-03-14
  • 2022-01-20
  • 2017-02-09
  • 2018-09-08
  • 2020-01-16
相关资源
最近更新 更多