Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/52.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails rmagick和imagemagick捆绑包/自制错误_Ruby On Rails_Imagemagick_Bundler_Homebrew_Rmagick - Fatal编程技术网

Ruby on rails rmagick和imagemagick捆绑包/自制错误

Ruby on rails rmagick和imagemagick捆绑包/自制错误,ruby-on-rails,imagemagick,bundler,homebrew,rmagick,Ruby On Rails,Imagemagick,Bundler,Homebrew,Rmagick,请参阅下面的错误堆栈。我尝试通过自制的“gem pristine rmagick”卸载/安装imagemagick,并重新安装rmagick。都返回了相同的错误。任何帮助都将不胜感激——我已经在这里呆了一段时间了 $ gem install rmagick Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem

请参阅下面的错误堆栈。我尝试通过自制的“gem pristine rmagick”卸载/安装imagemagick,并重新安装rmagick。都返回了相同的错误。任何帮助都将不胜感激——我已经在这里呆了一段时间了

$ gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /Users/LU/.rvm/rubies/ruby-1.9.3-p362/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/local/bin/gcc-4.2... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagick++... no
Can't install RMagick 2.13.1. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

*** 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/Lungs/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
    --with-MagickCorelib
    --without-MagickCorelib
    --with-Magicklib
    --without-Magicklib
    --with-Magick++lib
    --without-Magick++lib


Gem files will remain installed in /Users/Lungs/.rvm/gems/ruby-1.9.3-p362/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/LU/.rvm/gems/ruby-1.9.3-p362/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

我们应该做到这一点。然后重新安装gems。

也有同样的问题,很容易修复

下面是解决方案中的skinny(rmagick已损坏,您必须创建符号链接才能使其正常工作):


或者,退回一个ImageMagick版本:

(via)


最终导致rails版本出现问题,需要更新和重新安装imagemagick/rmagick。

将标题放入正确位置的更好方法可能是将imagemagick Cell中的pkgconfig添加到PKG\u配置路径

将以下内容添加到我的~/.bash_配置文件中,然后对其进行寻源(
source~/.bash_配置文件
)对我很有用

export PKG_CONFIG_PATH="/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig:$PKG_CONFIG_PATH"

可能它需要一些imagemagick的开发包,在我的imagemagick安装中应该命名为libmagick dev,文件名略有不同。我没有使用
libMagick++-Q8.7.dylib
libMagick++-Q16.7.dylib。因此,我创建了指向这些文件的符号链接。成功了!谢谢你给我指出了正确的方向。我必须做同样的事情,因为我也做了
Q16.7
,但是
bundle安装
,然后工作了。谢谢!这里也一样-几个小时来一直试图解决这个问题。随着q16的修改,这起到了作用。如果错误地先运行Q8行,只需brew卸载,然后再次安装,然后运行Q16行。
cd /usr/local/Cellar/imagemagick/6.8.0-10/lib

ln -s libMagick++-Q8.7.dylib   libMagick++.dylib

ln -s libMagickCore-Q8.7.dylib libMagickCore.dylib

ln -s libMagickWand-Q8.7.dylib libMagickWand.dylib
> cd /usr/local

> brew versions imagemagick

6.7.7-6  git checkout 883f549 Library/Formula/imagemagick.rb
6.7.5-7  git checkout f965101 Library/Formula/imagemagick.rb
6.7.1-1  git checkout be8e0ff Library/Formula/imagemagick.rb
...

> git checkout 883f549 Library/Formula/imagemagick.rb

> brew install imagemagick
export PKG_CONFIG_PATH="/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig:$PKG_CONFIG_PATH"