ruby – 无法在Mac 10.9.5上安装Rmagick

前端之家收集整理的这篇文章主要介绍了ruby – 无法在Mac 10.9.5上安装Rmagick前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我尝试将rails从4.1.1升级到4.2.0,然后我遇到安装Rmagick的错误.
升级rails之前,Rmagick在rails4.1.1上运行良好.
重新安装 ImageMagick后我尝试了,但仍然出错.

这就是我得到的

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

        /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
    checking for Ruby version >= 1.8.5... yes
    checking for xcrun... yes
    checking for Magick-config... yes
    checking for ImageMagick version >= 6.4.9... yes
    checking for stdint.h... yes
    checking for sys/types.h... yes
    checking for wand/MagickWand.h... yes
    checking for snprintf() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes
    checking for AcquireImage() in assert.h,wand/MagickWand.h... no
    checking for AffinityImage() in assert.h,wand/MagickWand.h... no
    checking for AffinityImages() in assert.h,wand/MagickWand.h... no
    checking for AutoGammaImageChannel() in assert.h,wand/MagickWand.h... no
    checking for AutoLevelImageChannel() in assert.h,wand/MagickWand.h... no
    checking for BlueShiftImage() in assert.h,wand/MagickWand.h... no
    checking for ColorMatrixImage() in assert.h,wand/MagickWand.h... no
    checking for ConstituteComponentTerminus() in assert.h,wand/MagickWand.h... no
    checking for DeskewImage() in assert.h,wand/MagickWand.h... no
    checking for DestroyConstitute() in assert.h,wand/MagickWand.h... no
    checking for EncipherImage() in assert.h,wand/MagickWand.h... no
    checking for EqualizeImageChannel() in assert.h,wand/MagickWand.h... no
    checking for EvaluateImages() in assert.h,wand/MagickWand.h... no
    checking for FloodfillPaintImage() in assert.h,wand/MagickWand.h... no
    checking for FunctionImageChannel() in assert.h,wand/MagickWand.h... no
    checking for GetAuthenticIndexQueue() in assert.h,wand/MagickWand.h... no
    checking for GetAuthenticPixels() in assert.h,wand/MagickWand.h... no
    checking for GetImageAlphaChannel() in assert.h,wand/MagickWand.h... no
    checking for GetMagickFeatures() in assert.h,wand/MagickWand.h... no
    checking for GetVirtualPixels() in assert.h,wand/MagickWand.h... no
    checking for LevelImageColors() in assert.h,wand/MagickWand.h... no
    checking for LevelColorsImageChannel() in assert.h,wand/MagickWand.h... no
    checking for LevelizeImageChannel() in assert.h,wand/MagickWand.h... no
    checking for LiquidRescaleImage() in assert.h,wand/MagickWand.h... no
    checking for MagickLibAddendum() in assert.h,wand/MagickWand.h... yes
    checking for OpaquePaintImageChannel() in assert.h,wand/MagickWand.h... no
    checking for QueueAuthenticPixels() in assert.h,wand/MagickWand.h... no
    checking for RemapImage() in assert.h,wand/MagickWand.h... no
    checking for RemapImages() in assert.h,wand/MagickWand.h... no
    checking for RemoveImageArtifact() in assert.h,wand/MagickWand.h... no
    checking for RotationalBlurImage() in assert.h,wand/MagickWand.h... no
    checking for RotationalBlurImageChannel() in assert.h,wand/MagickWand.h... no
    checking for SelectiveBlurImageChannel() in assert.h,wand/MagickWand.h... no
    checking for SetImageAlphaChannel() in assert.h,wand/MagickWand.h... no
    checking for SetImageArtifact() in assert.h,wand/MagickWand.h... no
    checking for SetMagickMemoryMethods() in assert.h,wand/MagickWand.h... no
    checking for SparseColorImage() in assert.h,wand/MagickWand.h... no
    checking for StatisticImage() in assert.h,wand/MagickWand.h... no
    checking for SyncAuthenticPixels() in assert.h,wand/MagickWand.h... no
    checking for TransformImageColorspace() in assert.h,wand/MagickWand.h... no
    checking for TransparentPaintImage() in assert.h,wand/MagickWand.h... no
    checking for TransparentPaintImageChroma() in assert.h,wand/MagickWand.h... no
    checking for QueryMagickColorname() new signature... yes
    checking for Image.type in assert.h,wand/MagickWand.h... yes
    checking for DrawInfo.kerning in assert.h,wand/MagickWand.h... yes
    checking for DrawInfo.interline_spacing in assert.h,wand/MagickWand.h... yes
    checking for DrawInfo.interword_spacing in assert.h,wand/MagickWand.h... yes
    checking for DitherMethod in assert.h,wand/MagickWand.h... yes
    checking for MagickFunction in assert.h,wand/MagickWand.h... yes
    checking for ImageLayerMethod in assert.h,wand/MagickWand.h... yes
    checking for long double in assert.h,wand/MagickWand.h... yes
    checking for AlphaChannelType.CopyAlphaChannel... yes
    checking for AlphaChannelType.BackgroundAlphaChannel... yes
    checking for CompositeOperator.BlurCompositeOp... yes
    checking for CompositeOperator.DistortCompositeOp... yes
    checking for CompositeOperator.LinearBurnCompositeOp... yes
    checking for CompositeOperator.LinearDodgeCompositeOp... yes
    checking for CompositeOperator.MathematicsCompositeOp... yes
    checking for CompositeOperator.PegtopLightCompositeOp... yes
    checking for CompositeOperator.PinLightCompositeOp... yes
    checking for CompositeOperator.VividLightCompositeOp... yes
    checking for CompressionType.DXT1Compression... yes
    checking for CompressionType.DXT3Compression... yes
    checking for CompressionType.DXT5Compression... yes
    checking for CompressionType.ZipSCompression... yes
    checking for CompressionType.PizCompression... yes
    checking for CompressionType.Pxr24Compression... yes
    checking for CompressionType.B44Compression... yes
    checking for CompressionType.B44ACompression... yes
    checking for DistortImageMethod.BarrelDistortion... yes
    checking for DistortImageMethod.BarrelInverseDistortion... yes
    checking for DistortImageMethod.BilinearForwardDistortion... yes
    checking for DistortImageMethod.BilinearReverseDistortion... yes
    checking for DistortImageMethod.DePolarDistortion... yes
    checking for DistortImageMethod.PolarDistortion... yes
    checking for DistortImageMethod.PolynomialDistortion... yes
    checking for DistortImageMethod.ShepardsDistortion... yes
    checking for DitherMethod.NoDitherMethod... yes
    checking for FilterTypes.KaiserFilter... yes
    checking for FilterTypes.WelshFilter... yes
    checking for FilterTypes.ParzenFilter... yes
    checking for FilterTypes.LagrangeFilter... yes
    checking for FilterTypes.BohmanFilter... yes
    checking for FilterTypes.BartlettFilter... yes
    checking for FilterTypes.SentinelFilter... yes
    checking for MagickEvaluateOperator.PowEvaluateOperator... yes
    checking for MagickEvaluateOperator.LogEvaluateOperator... yes
    checking for MagickEvaluateOperator.ThresholdEvaluateOperator... yes
    checking for MagickEvaluateOperator.ThresholdBlackEvaluateOperator... yes
    checking for MagickEvaluateOperator.ThresholdWhiteEvaluateOperator... yes
    checking for MagickEvaluateOperator.GaussianNoiseEvaluateOperator... yes
    checking for MagickEvaluateOperator.ImpulseNoiseEvaluateOperator... yes
    checking for MagickEvaluateOperator.LaplacianNoiseEvaluateOperator... yes
    checking for MagickEvaluateOperator.MultiplicativeNoiseEvaluateOperator... yes
    checking for MagickEvaluateOperator.PoissonNoiseEvaluateOperator... yes
    checking for MagickEvaluateOperator.UniformNoiseEvaluateOperator... yes
    checking for MagickEvaluateOperator.CosineEvaluateOperator... yes
    checking for MagickEvaluateOperator.SineEvaluateOperator... yes
    checking for MagickEvaluateOperator.AddModulusEvaluateOperator... yes
    checking for MagickFunction.ArcsinFunction... yes
    checking for MagickFunction.ArctanFunction... yes
    checking for MagickFunction.PolynomialFunction... yes
    checking for MagickFunction.SinusoidFunction... yes
    checking for ImageLayerMethod.FlattenLayer... yes
    checking for ImageLayerMethod.MergeLayer... yes
    checking for ImageLayerMethod.MosaicLayer... yes
    checking for ImageLayerMethod.TrimBoundsLayer... yes
    checking for VirtualPixelMethod.HorizontalTileVirtualPixelMethod... yes
    checking for VirtualPixelMethod.VerticalTileVirtualPixelMethod... yes
    checking for VirtualPixelMethod.HorizontalTileEdgeVirtualPixelMethod... yes
    checking for VirtualPixelMethod.VerticalTileEdgeVirtualPixelMethod... yes
    checking for VirtualPixelMethod.CheckerTileVirtualPixelMethod... yes
    checking for ruby/io.h... yes
    checking for rb_frame_this_func() in ruby.h,ruby/io.h... yes
    creating extconf.h
    creating Makefile


    ======================================================================
    Sat 31Jan15 12:34:19
    This installation of RMagick 2.13.4 is configured for
    Ruby 2.0.0 (universal.x86_64-darwin13) and ImageMagick 
    ======================================================================



    make "DESTDIR="
    compiling rmagick.c
    compiling rmdraw.c
    ~~~~~~~~~~~~~~~~~
compile some files
    ~~~~~~~~~~~~~~~~~
    compiling rminfo.c
    compiling rmmain.c
    rmmain.c:1724:28: error: use of undeclared identifier 'MagickSupport'
        features = rb_str_new2(MagickSupport);
                               ^
    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/intern.h:760:27: note: expanded from macro 'rb_str_new_cstr'
        (__builtin_constant_p(str)) ?               \
                              ^
    rmmain.c:1724:28: error: use of undeclared identifier 'MagickSupport'
    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/intern.h:761:14: note: expanded from macro 'rb_str_new_cstr'
            rb_str_new((str),(long)strlen(str)) :  \
                        ^
    rmmain.c:1724:28: error: use of undeclared identifier 'MagickSupport'
    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/intern.h:762:18: note: expanded from macro 'rb_str_new_cstr'
            rb_str_new_cstr(str);                   \
                            ^
    rmmain.c:1724:14: error: assigning to 'volatile VALUE' (aka 'volatile unsigned long') from incompatible type 'void'
        features = rb_str_new2(MagickSupport);
                 ^
    4 errors generated.
    make: *** [rmmain.o] Error 1


    Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/rmagick-2.13.4 for inspection.
    Results logged to /Library/Ruby/Gems/2.0.0/gems/rmagick-2.13.4/ext/RMagick/gem_make.out

而且,这些是更多的信息.

ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]


 brew info imagemagick
imagemagick: stable 6.9.0-3 (bottled),HEAD
http://www.imagemagick.org
/usr/local/Cellar/imagemagick/6.9.0-3 (1440 files,22M) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/imagemagick.rb
==> Dependencies
Build: xz ✔,pkg-config ✔
required: libtool ✔,xz ✔
Recommended: jpeg ✔,libpng ✔,freetype ✔
Optional: fontconfig ✘,libtiff ✘,little-cms ✘,little-cms2 ✘,libwmf ✘,librsvg ✘,liblqr ✘,openexr ✘,ghostscript ✘,webp ✘,fftw ✘
==> Options
--enable-hdri
    Compile with HDRI support
--with-fftw
    Compile with FFTW support
--with-fontconfig
    Build with fontconfig support
--with-ghostscript
    Build with ghostscript support
--with-jp2
    Compile with Jpeg2000 support
--with-liblqr
    Build with liblqr support
--with-librsvg
    Build with librsvg support
--with-libtiff
    Build with libtiff support
--with-libwmf
    Build with libwmf support
--with-little-cms
    Build with little-cms support
--with-little-cms2
    Build with little-cms2 support
--with-openexr
    Build with openexr support
--with-perl
    enable build/install of PerlMagick
--with-quantum-depth-16
    Compile with a quantum depth of 16 bit
--with-quantum-depth-32
    Compile with a quantum depth of 32 bit
--with-quantum-depth-8
    Compile with a quantum depth of 8 bit
--with-webp
    Build with webp support
--with-x11
    Build with x11 support
--without-freetype
    Build without freetype support
--without-jpeg
    Build without jpeg support
--without-libpng
    Build without libpng support
--without-magick-plus-plus
    disable build/install of Magick++
--HEAD
    Install HEAD version

先感谢您

解决方法

我在OSX 10.10.2(优胜美地)上用rmagick 2.13.4得到了同样的错误.
该问题已在最新代码上修复.请参阅下面的问题.

>修复#148; bf4更强大的特征检测·Pull Request#156
https://github.com/gemhome/rmagick/pull/156
>从gemhome / fix_features_detection合并拉取请求#156
https://github.com/gemhome/rmagick/commit/f261a6ffd03f538fbaabcf61a55cab58f4e8abbb?diff=unified

然而,新版本尚未正式发布,所以我使用上面的代码在本地解决了这个问题.

$git clone -b RMagick_2-13-4 git://github.com/gemhome/rmagick.git

合并修复代码(替换ext / RMagick / rmmain.c中的相关代码).

#if defined(HAVE_GETMAGICKFEATURES)
  // 6.5.7 - latest (7.0.0)
  features = rb_str_new2(GetMagickFeatures());
#elif defined(MagickFeatures)
  // 6.5.7 - latest (7.0.0)
  features = rb_str_new2(MagickFeatures);
#elif defined(MagickSupport)
  // 6.5.5 - 6.5.6
  features = rb_str_new2(MagickSupport);
#else
  features = rb_str_new("unknown",7);
#endif

然后安装它.

$cd rmagick/
$gem build rmagick.gemspec
$gem install --local rmagick-2.13.4.gem 
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.4
1 gem installed

我希望它有所帮助.

原文链接:https://www.f2er.com/ruby/268840.html

猜你在找的Ruby相关文章