【问题标题】:Cant install rmagick Gem On OSX无法在 OSX 上安装 rmagick Gem
【发布时间】:2018-02-15 23:41:26
【问题描述】:

我错过了什么?

这是我的 imagemagick 酿造信息

❯ brew info imagemagick
imagemagick: stable 7.0.7-22 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/imagemagick/7.0.7-22 (1,527 files, 23.3MB) *
  Poured from bottle on 2018-02-15 at 15:36:50
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick.rb
==> Dependencies
Build: pkg-config ✔
Required: libtool ✔, xz ✔
Recommended: jpeg ✔, libpng ✔, libtiff ✔, freetype ✔
Optional: fontconfig ✘, little-cms ✘, little-cms2 ✘, libwmf ✘, librsvg ✘, liblqr ✘, openexr ✘, ghostscript ✘, webp ✘, openjpeg ✘, fftw ✘, pango ✘, perl ✘
==> Requirements
Optional: x11 ✘
==> Options
--with-fftw
    Compile with FFTW support
--with-fontconfig
    Build with fontconfig support
--with-ghostscript
    Build with ghostscript support
--with-hdri
    Compile with HDRI support
--with-liblqr
    Build with liblqr support
--with-librsvg
    Build with librsvg support
--with-libwmf
    Build with libwmf support
--with-little-cms
    Build with little-cms support
--with-little-cms2
    Build with little-cms2 support
--with-opencl
    Compile with OpenCL support
--with-openexr
    Build with openexr support
--with-openjpeg
    Build with openjpeg support
--with-openmp
    Compile with OpenMP support
--with-pango
    Build with pango support
--with-perl
    Compile with PerlMagick
--with-webp
    Build with webp support
--with-x11
    Build with x11 support
--with-zero-configuration
    Disables depending on XML configuration files
--without-freetype
    Build without freetype support
--without-jpeg
    Build without jpeg support
--without-libpng
    Build without libpng support
--without-libtiff
    Build without libtiff support
--without-magick-plus-plus
    disable build/install of Magick++
--without-modules
    Disable support for dynamically loadable modules
--without-threads
    Disable threads support
--HEAD
    Install HEAD version

这是我尝试安装时的 gem 信息

❯ gem install rmagick -v '2.13.2'
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

    current directory: /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/gems/rmagick-2.13.2/ext/RMagick
/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20180215-65975-100ukqk.rb 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 /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/bin:/Users/joshchernoff/.rvm/gems/ruby-2.3.1@global/bin:/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin:/Users/joshchernoff/.rvm/bin:/Users/joshchernoff/.asdf/bin:/Users/joshchernoff/.asdf/shims:.git/safe/../../bin:/Users/joshchernoff/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/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
    --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=/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/extensions/x86_64-darwin-17/2.3.0/rmagick-2.13.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/gems/rmagick-2.13.2 for inspection.

日志文件

❯ cat /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/extensions/x86_64-darwin-17/2.3.0/rmagick-2.13.2/gem_make.out
current directory: /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/gems/rmagick-2.13.2/ext/RMagick
/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20180215-65975-100ukqk.rb 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 /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/bin:/Users/joshchernoff/.rvm/gems/ruby-2.3.1@global/bin:/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin:/Users/joshchernoff/.rvm/bin:/Users/joshchernoff/.asdf/bin:/Users/joshchernoff/.asdf/shims:.git/safe/../../bin:/Users/joshchernoff/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/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
    --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=/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/extensions/x86_64-darwin-17/2.3.0/rmagick-2.13.2/mkmf.log

extconf failed, exit code 1

mk 文件

❯ cat /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/extensions/x86_64-darwin-17/2.3.0/rmagick-2.13.2/mkmf.log
checking for Ruby version >= 1.8.5... -------------------- yes

--------------------

find_executable: checking for gcc... -------------------- yes

--------------------

find_executable: checking for Magick-config... -------------------- no

--------------------

Can't install RMagick 2.13.2. Can't find Magick-config in /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/bin:/Users/joshchernoff/.rvm/gems/ruby-2.3.1@global/bin:/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin:/Users/joshchernoff/.rvm/bin:/Users/joshchernoff/.asdf/bin:/Users/joshchernoff/.asdf/shims:.git/safe/../../bin:/Users/joshchernoff/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin

【问题讨论】:

  • 你能看看它指向你使用的日志文件发布相关部分吗?
  • 我更新了问题。
  • 也许 Rmagick 期待 ImageMagick 6 而不是 Imagemagick 7。IM 7 的语法是 magick 而不是 convert。所以也许 Rmagick 正在尝试寻找 convert 并且只找到了 magick

标签: ruby rmagick


【解决方案1】:

日志文件指出错误:Can't find Magick-config in [PATH]

所以在你的文件系统上找到Magick-config 文件并将它放在你的路径中,例如通过运行

locate Magick-config

对我来说返回:

/usr/local/Cellar/imagemagick@6/6.9.9-34/bin/Magick-config

如果您在任何地方都找不到Magick-config 文件,请找出为什么没有。

即使您克服了该错误,您仍然无法让 rmagick 工作,因为尚不支持 ImageMagick 7。 相关 Github 问题:

还有另一个 StackOverflow 答案,解释了如何让它工作:ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h

【讨论】:

    猜你喜欢
    • 2012-04-21
    • 2012-12-07
    • 1970-01-01
    • 2012-11-26
    • 2013-08-20
    • 2011-06-19
    • 1970-01-01
    • 2014-10-05
    • 2012-03-13
    相关资源
    最近更新 更多