简体   繁体   English

rmagick gem 安装问题未声明的标识符 'IsGrayImage' Macbook M1

[英]rmagick gem install problem undeclared identifier 'IsGrayImage' Macbook M1

I'm having problems installing Rmagick gem on my M1 Macbook.我在 M1 Macbook 上安装 Rmagick gem 时遇到问题。 I installed the latest version of ImageMagick via brew arch -arm64 brew install imagemagick and tested it with the following commands:我通过 brew arch -arm64 brew install imagemagick安装了最新版本的 ImageMagick 并使用以下命令对其进行了测试:

magick logo: logo.gif

identify logo.gif

Once I confirmed it was working correctly I added the rmagick gem to my Gemfile.一旦我确认它工作正常,我就将 rmagick gem 添加到我的 Gemfile 中。 Below is the output of the bundle install command.下面是bundle install命令的输出。

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/user/.rvm/gems/ruby-2.7.2/gems/rmagick-4.2.2/ext/RMagick
/Users/user/.rvm/rubies/ruby-2.7.2/bin/ruby -I /Users/user/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0 -r ./siteconf20210721-75512-tve65x.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
checking for forced use of ImageMagick 6... no
checking for outdated ImageMagick version (<= 6.7.7)... no
checking for gcc... yes
checking for __GNUC__... yes
checking for MagickCore/MagickCore.h... yes
checking for rb_gc_adjust_memory_usage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... yes
checking for posix_memalign() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... yes
checking for malloc_usable_size() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for malloc_size() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... yes
checking for _aligned_msize() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for GetImageChannelEntropy() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for SetImageGray() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for SetMagickAlignedMemoryMethods() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for malloc.h... no
checking for malloc/malloc.h... yes
creating extconf.h
creating Makefile
======================================================================
Wed 21 Jul 21 07:25:56
This installation of RMagick 4.2.2 is configured for
Ruby 2.7.2 (x86_64-darwin20) and ImageMagick 7.1.0
======================================================================


Configured compile options: {:magick_version=>"7.1.0", :local_libs=>" -L/opt/homebrew/Cellar/imagemagick/7.1.0-4_1/lib -lMagickCore-7.Q16HDRI", :cflags=>" -Xpreprocessor -fopenmp
-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/homebrew/Cellar/imagemagick/7.1.0-4_1/include/ImageMagick-7 -std=gnu99", :cppflags=>" -Xpreprocessor -fopenmp
-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/homebrew/Cellar/imagemagick/7.1.0-4_1/include/ImageMagick-7", :ldflags=>"
-L/opt/homebrew/Cellar/imagemagick/7.1.0-4_1/lib -lMagickCore-7.Q16HDRI", :defs=>[], :config_h=>"Makefile"}

current directory: /Users/user/.rvm/gems/ruby-2.7.2/gems/rmagick-4.2.2/ext/RMagick
make DESTDIR\= clean

current directory: /Users/user/.rvm/gems/ruby-2.7.2/gems/rmagick-4.2.2/ext/RMagick
make DESTDIR\=
compiling rmagick.c
compiling rmdraw.c
compiling rmenum.c
compiling rmfill.c
compiling rmilist.c
compiling rmimage.c
rmimage.c:7552:32: error: use of undeclared identifier 'IsGrayImage'
    return has_attribute(self, IsGrayImage);
                               ^
1 error generated.
make: *** [Makefile:245: rmimage.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/user/.rvm/gems/ruby-2.7.2/gems/rmagick-4.2.2 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-2.7.2/extensions/x86_64-darwin-20/2.7.0/rmagick-4.2.2/gem_make.out

An error occurred while installing rmagick (4.2.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '4.2.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rmagick

Make sure your Ruby, rmagick and ImageMagick are all 64-bit or are all 32-bit.确保您的 Ruby、rmagick 和 ImageMagick 都是 64 位或都是 32 位。 That was my problem on Windows 10 (see Github post you replied to).那是我在 Windows 10 上的问题(请参阅您回复的 Github 帖子)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM