在 Amezon AMI 服务器上安装 rmagick gem 时出现 ImageMagick 依赖项错误
构建本机扩展。这可能需要一段时间... 错误:安装 rmagick 时出错: 错误:无法构建 gem 本机扩展。
current directory: /home/ec2-user/.rvm/gems/ruby-2.6.5/gems/rmagick-4.2.2/ext/RMagick
/home/ec2-user/.rvm/rubies/ruby-2.6.5/bin/ruby -I /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210806-10706-10mubyf.rb extconf.rb 检查酿造...没有 正在检查 pacman...没有 检查 Ruby 版本 >= 2.3.0... 是 检查 pkg-config...是的 正在检查过时的 ImageMagick 版本 (<= 6.7.7)...否 检查 gcc...是的 检查 GNUC...*** extconf.rb 失败 *** 由于某种原因无法创建 Makefile,可能缺乏必要的 库和/或标头。检查 mkmf.log 文件以获取更多详细信息。您可以 需要配置选项。
提供的配置选项: --with-opt-dir --没有选择目录 --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --没有make-prog --srcdir=. --curdir --ruby=/home/ec2-user/.rvm/rubies/ruby-2.6.5/bin/$(RUBY_BASE_NAME) /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:467:in try_do':编译器无法生成可执行文件。 (RuntimeError) 您必须先安装开发工具。来自 /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:585:in
block in try_compile' 来自 /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:534:in with_werror' 来自 /home/ec2-user/.rvm/ rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:585:in
try_compile' 来自 /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:852:in macro_defined?'来自 /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:994:in
block in have_macro' 来自 /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:959:in 来自 /home/ec2-user/ 的 check_for' 中的 块。 rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:361:in
块(2级)推迟' 来自 /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:331:in open' 来自 /home/ec2-user/.rvm/ rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:361:in
块推迟' 来自 /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:331:in open' 来自 /home/ec2-user/.rvm/ rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:357:in
推迟' 来自 /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:958:in checking_for' 来自 /home/ec2-user/.rvm/ rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:993:in
have_macro' 来自 extconf.rb:99:in configure_compile_options' 来自 extconf.rb:19:in
initialize' from extconf.rb:398:in new' from extconf.rb:398:in
'
要了解此扩展无法编译的原因,请检查可在此处找到的 mkmf.log:
/home/ ec2-user/.rvm/gems/ruby-2.6.5/extensions/x86_64-linux/2.6.0/rmagick-4.2.2/mkmf.log
extconf 失败,退出代码 1
Gem 文件将保留安装在 /home/ec2-user/.rvm/gems/ruby-2.6.5/gems/rmagick-4.2.2 中以供检查。 结果记录到 /home/ec2-user/.rvm/gems/ruby-2.6.5/extensions/x86_64-linux/2.6.0/rmagick-4.2.2/gem_make.out
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.rvm/gems/ruby-2.6.5/gems/rmagick-4.2.2/ext/RMagick
/home/ec2-user/.rvm/rubies/ruby-2.6.5/bin/ruby -I /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210806-10706-10mubyf.rb extconf.rb
checking for brew... no
checking for pacman... no
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.7.7)... no
checking for gcc... yes
checking for GNUC... *** 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
--without-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=/home/ec2-user/.rvm/rubies/ruby-2.6.5/bin/$(RUBY_BASE_NAME)
/home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:467:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:585:in
block in try_compile'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:534:in with_werror' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:585:in
try_compile'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:852:in macro_defined?' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:994:in
block in have_macro'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:959:in block in checking_for' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:361:in
block (2 levels) in postpone'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:331:in open' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:361:in
block in postpone'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:331:in open' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:357:in
postpone'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:958:in checking_for' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:993:in
have_macro'
from extconf.rb:99:in configure_compile_options' from extconf.rb:19:in
initialize'
from extconf.rb:398:in new' from extconf.rb:398:in
'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ec2-user/.rvm/gems/ruby-2.6.5/extensions/x86_64-linux/2.6.0/rmagick-4.2.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/ec2-user/.rvm/gems/ruby-2.6.5/gems/rmagick-4.2.2 for inspection.
Results logged to /home/ec2-user/.rvm/gems/ruby-2.6.5/extensions/x86_64-linux/2.6.0/rmagick-4.2.2/gem_make.out
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
输出:
版本:ImageMagick 6.9.10-68 Q16 x86_64 2021-02-03 https://imagemagick.org
版权所有:© 1999-2019 ImageMagick Studio LLC
许可证:https://imagemagick.org/script/license.php
特点: 密码 DPC 模块 OpenMP(3.1)
委托(内置): bzlib fontconfig freetype gslib jng jpeg lcms ltdl lzma png ps tiff wmf x xml zlib
3.gem安装rmagick
如果仍然出现错误,请按照以下命令操作
再次运行 gem install rmagick 一切就完成了。
您可以找到下面的链接
https://senrenseyo.com/20210811/rails6_rmagick/
Output:
Version: ImageMagick 6.9.10-68 Q16 x86_64 2021-02-03 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(3.1)
Delegates (built-in): bzlib fontconfig freetype gslib jng jpeg lcms ltdl lzma png ps tiff wmf x xml zlib
3. gem install rmagick
if you still get the error follow below commands
And run again gem install rmagick and its all done.
You can find the link below
https://senrenseyo.com/20210811/rails6_rmagick/