簡體   English   中英

Bundle 無法在 Mac OSX 10.7 上安裝 RMagick gem

[英]Bundle can't install RMagick gem on Mac OSX 10.7

我已經使用 ImageMagick 安裝程序腳本 ImageMagick 安裝了https://github.com/maddox/magick-installer 我在 OSX Lion 10.7 上,使用 RVM,Ruby 1.9.3p125。

問題似乎出在 MagickWand.h 這里是完整的日志

/Users/pdjimeno/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** 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/pdjimeno/.rvm/rubies/ruby-1.9.3-p125/bin/ruby

將此設置修復為當前 imagemagick 安裝的包含路徑:

用 brew 安裝 ImageMagick

brew install imagemagick

找圖書館

$ mdfind MagickWand.h
/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/wand/MagickWand.h

安裝 rmagick gem

$ C_INCLUDE_PATH=/path gem install rmagick

例子:

$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/ gem install rmagick

如果您收到 Package xxx未找到。

找到 package 並將其目錄路徑添加到~/.bash_login~/.bash_profile文件中的PKG_CONFIG_PATH變量。

例子:

如果您收到錯誤:

Package MagickCore was not found in the pkg-config search path.

找到文件所在的位置:

$ mdfind magickcore.pc
/usr/local/homebrew/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/MagickCore.pc

添加到您的 bash_login 或 bash_profile:

export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:/usr/local/homebrew/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/:$PKG_CONFIG_PATH"

記得獲取 bash_login/profile 文件

我建議您使用brew來管理您的二進制依賴項。 您可以使用brew輕松安裝 imageMagick,如下所示:

brew install imagemagick

這是我系統上的內容:

imagemagick 6.7.1-1
http://www.imagemagick.org
Depends on: jpeg, libtiff, little-cms, jasper
/usr/local/Cellar/imagemagick/6.7.1-1 (1389 files, 32M)
http://github.com/mxcl/homebrew/commits/master/Library/Formula/imagemagick.rb

在機器和 ruby 版本方面,我的設置與您的設置相同。

在撰寫本文時,imagemagick 7 是通過brew install imagemagick安裝的默認版本,但與rmagick不兼容。 通過以下方式解決此問題:

  1. 使用自制軟件刪除當前安裝的 imagemagick 版本

brew uninstall imagemagick

  1. 安裝 imagemagick 6:

brew install imagemagick@6

  1. 使用 pkgconfig 變量運行 gem install(可能需要sudo ,具體取決於您的配置)

PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick

還找到了使用自制軟件的解決方案:

brew remove --force pkg-config
brew install pkg-config

接着

gem install rmagick

1)安裝程序安裝

http://cactuslab.com/imagemagick/

2)嘗試 gem 安裝 rmagick

如果檢查 wand/MagickWand.h... 不
類型

mdfind MagickWand.h

找到類似的東西

/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h

並輸入終端

C_INCLUDE_PATH=/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/ gem install rmagick

如果在那之后你有這個錯誤(因為有它)“Package MagickCore was not found in the pkg-config search path.”

類型

mdfind MagickCore.pc

找到類似 /opt/ImageMagick/lib/pkgconfig/MagickCore.pc 的東西

最后是終端類型:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick

Andrey Yasinishyn 的解決方案對我有用:

mdfind MagickCore.pc

找到類似 /opt/ImageMagick/lib/pkgconfig/MagickCore.pc 的東西

最后是終端類型:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick

當我遇到這個問題時,它抱怨找不到 MagickCore.pc,所以我這樣做了;

$ mdfind MagickCore.h
/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick/magick/MagickCore.h
/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/magick/MagickCore.h

$ export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/
$ gem install rmagick

它奏效了!

我嘗試了一切,但最終的解決方案是:

brew uninstall --force imagemagick # 刪除所有版本

然后

brew install imagemagick@6

最后

gem install rmagick

對於它的價值,我在 Ruby ree-1.8.7-2012-02 上遇到了這個問題。 這是我修復它的方法:

我刪除了 ImageMagick 並重新安裝了它

brew remove imagemagick 
brew install imagemagick --disable-openmp --build-from-source

然后我在 /usr/local/Cellar/imagemagick/6.8.9-7/lib/ 中添加了這些符號鏈接

ln -s libMagick++-6.Q16.5.dylib libMagick++.dylib
ln -s libMagickCore-6.Q16.2.dylib libMagickCore.dylib
ln -s libMagickWand-6.Q16.2.dylib libMagickWand.dylib

然后我刪除了 Ruby 版本並重新安裝它

rvm remove ree-1.8.7-2012-02
rvm install ree-1.8.7-2012-02

終於安裝了寶石

gem install rmagick -v '2.12.2'

希望這可以幫助。

對於 El Capitan 用戶,

需要包含 PKG_CONFIG_FILE 和 C_INCLUDE_PATH。 對我有用的命令是:

sudo C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.9.2-4/include/ImageMagick/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.9.2-4/lib/pkgconfig/ gem install rmagick

我必須添加兩個 env 變量才能使其工作。 像這樣的東西

C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/ PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/ gem install rmagick 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM