RMagick安装无法构建本机扩展

在山狮我试图安装RMagick。 我在GitHub上发现了一个问题,解决方案应该是命令gem pristine rmagick 。 但是当我运行它时,我得到:

 ERROR: While executing gem ... (Gem::Exception) Failed to find gems ["rmagick"] >= 0 

当我运行gem install rmagick ,我收到了这个巨大的错误:

 Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. /Users/xxxxx/.rvm/rubies/ruby-1.9.3-p327/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 clang... yes checking for Magick-config... yes Warning: Found more than one ImageMagick installation. This could cause problems at runtime. /usr/local/bin/Magick-config reports version 6.7.7 Q16 is installed in /usr/local/Cellar/imagemagick/6.7.7-6 /opt/ImageMagick/bin/Magick-config reports version 6.7.8 Q16 is installed in /opt/ImageMagick Using 6.7.7 Q16 from /usr/local/Cellar/imagemagick/6.7.7-6. 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... 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,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for AffinityImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for AffinityImages() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for AutoGammaImageChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for AutoLevelImageChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for BlueShiftImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for ConstituteComponentTerminus() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for DeskewImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for EncipherImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for EqualizeImageChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for FloodfillPaintImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for FunctionImageChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for GetAuthenticIndexQueue() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for GetAuthenticPixels() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for GetImageAlphaChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for GetVirtualPixels() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for LevelImageColors() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for LevelColorsImageChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for LevelizeImageChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for LiquidRescaleImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for MagickLibAddendum() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for OpaquePaintImageChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for QueueAuthenticPixels() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for RemapImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for RemoveImageArtifact() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for SelectiveBlurImageChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for SetImageAlphaChannel() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for SetImageArtifact() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for SetMagickMemoryMethods() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for SparseColorImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for SyncAuthenticPixels() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for TransparentPaintImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for TransparentPaintImageChroma() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for QueryMagickColorname() new signature... yes checking for Image.type in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for DrawInfo.kerning in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for DrawInfo.interline_spacing in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for DrawInfo.interword_spacing in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for DitherMethod in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for MagickFunction in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for ImageLayerMethod in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h... yes checking for long double in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.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 22Dec12 21:51:19 This installation of RMagick 2.13.1 is configured for Ruby 1.9.3 (x86_64-darwin12.2.0) and ImageMagick 6.7.7 Q16 ====================================================================== make compiling rmagick.c compiling rmdraw.c compiling rmenum.c rmenum.c:450:13: warning: 4 enumeration values not handled in switch: 'DivideSrcCompositeOp', 'MinusSrcCompositeOp', 'DarkenIntensityCompositeOp'... [-Wswitch] switch (op) ^ rmenum.c:565:13: warning: enumeration values 'LZMACompression', 'JBIG1Compression', and 'JBIG2Compression' not handled in switch [-Wswitch] switch (ct) ^ rmenum.c:674:12: warning: 7 enumeration values not handled in switch: 'SincFastFilter', 'LanczosSharpFilter', 'Lanczos2Filter'... [-Wswitch] switch(type) ^ rmenum.c:922:12: warning: 5 enumeration values not handled in switch: 'Average9InterpolatePixel', 'Average16InterpolatePixel', 'BlendInterpolatePixel'... [-Wswitch] switch(interpolate) ^ 4 warnings generated. compiling rmfill.c compiling rmilist.c rmilist.c:448:12: warning: 'MapImages' is deprecated [-Wdeprecated-declarations] (void) MapImages(new_images, map, dither); ^ /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/magick/deprecate.h:197:3: note: 'MapImages' declared here MapImages(Image *,const Image *,const MagickBooleanType) ^ 1 warning generated. compiling rmimage.c rmimage.c:8155:12: warning: 'MapImage' is deprecated [-Wdeprecated-declarations] (void) MapImage(new_image, map, dither); ^ /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/magick/deprecate.h:195:3: note: 'MapImage' declared here MapImage(Image *,const Image *,const MagickBooleanType) ^ rmimage.c:10701:17: warning: 'RecolorImage' is deprecated [-Wdeprecated-declarations] new_image = RecolorImage(image, order, matrix, &exception); ^ /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/magick/deprecate.h:139:4: note: 'RecolorImage' declared here *RecolorImage(const Image *,const size_t,const double *,ExceptionInfo *) ^ 2 warnings generated. compiling rminfo.c compiling rmmain.c compiling rmmontage.c compiling rmpixel.c compiling rmstruct.c compiling rmutil.c rmutil.c:1612:43: warning: format string is not a string literal (potentially insecure) [-Wformat-security] rb_raise(Class_FatalImageMagickError, GetLocaleExceptionMessage(severity, reason)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rmutil.c:1652:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security] rb_warning(msg); ^~~ 2 warnings generated. linking shared-object RMagick2.bundle ld: file not found: /usr/local/lib/libfreetype.6.dylib for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [RMagick2.bundle] Error 1 Gem files will remain installed in /Users/xxxxx/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1 for inspection. Results logged to /Users/xxxxx/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/ext/RMagick/gem_make.out 

ImageMagick的版本是6.7.7-6。

你能帮帮我,如何摆脱这个错误以及如何最终在Mountain Lion上安装RMagick?

你是否在安装gem之前使用brew来安装’imagemagick’?

这有助于:

 brew update brew remove imagemagick brew install imagemagick 

其他如果以前仍未解决您的问题:

 brew install freetype 

要么

 brew unlink freetype && brew link freetype 

或者安装XQuartz 。

或者在rmagick GitHub页面上查看此评论 。

要么

 ln -s /opt/X11/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.6.dylib