在 Amezon AMI 服务器上安装 rmagick gem 时出现 ImageMagick 依赖项错误

发布于 2025-01-12 03:26:39 字数 2658 浏览 4 评论 0原文

构建本机扩展。这可能需要一段时间... 错误:安装 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:inblock 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:intry_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:inblock 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:inhave_macro' 来自 extconf.rb:99:in configure_compile_options' 来自 extconf.rb:19:ininitialize' 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:inblock 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:intry_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:inblock 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:inblock (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:inblock 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:inpostpone'
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:inhave_macro'
from extconf.rb:99:in configure_compile_options' from extconf.rb:19:ininitialize'
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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小女人ら 2025-01-19 03:26:39
  1. sudo yum -y 安装 ImageMagick ImageMagick-devel
  2. 转换 -version
    输出:

版本: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
如果仍然出现错误,请按照以下命令操作

  1. sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/libgomp.spec /usr/lib64/libgomp.spec
  2. sudo ln -s /usr/lib/ gcc/x86_64-amazon-linux/4.8.5/libgomp.a /usr/lib64/libgomp.a
  3. sudo ln -s /usr/lib64/libgomp.so.1.0.0 /usr/lib64/libgomp.so
    再次运行 gem install rmagick 一切就完成了。

您可以找到下面的链接
https://senrenseyo.com/20210811/rails6_rmagick/

  1. sudo yum -y install ImageMagick ImageMagick-devel
  2. convert -version
    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

  1. sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/libgomp.spec /usr/lib64/libgomp.spec
  2. sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/libgomp.a /usr/lib64/libgomp.a
  3. sudo ln -s /usr/lib64/libgomp.so.1.0.0 /usr/lib64/libgomp.so
    And run again gem install rmagick and its all done.

You can find the link below
https://senrenseyo.com/20210811/rails6_rmagick/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文