Ruby-on-rails 安装 rmagick (2.13.2) 时出错,Bundler 无法继续

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21901657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 23:23:16  来源:igfitidea点击:

An error occurred while installing rmagick (2.13.2), and Bundler cannot continue

ruby-on-rails

提问by venu

using gem magick' and am using rails 3.1.0

使用 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.

回答by Marek Lipka

You should install ImageMagick first:

您应该先安装 ImageMagick:

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

回答by xke

On Mac, I did brew install imagemagick.

在 Mac 上,我做到了brew install imagemagick

That successfully allowed me to run gem install rmagick -v '2.13.2'without issues.

这成功地让我可以gem install rmagick -v '2.13.2'毫无问题地运行。

回答by Milind S. Pandit

Try

尝试

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

or

或者

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

and then $ gem install rmagickshould work

然后$ gem install rmagick应该工作