Ubuntu 18.04.03 LTS-由于rMagick,捆绑安装会引发错误

问题描述 投票:0回答:1

我正在MacOS上设置我的VM Ubuntu 18.04.03。给予: Ubuntu 18.04.03 LTS ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] Expected Rails version set in Gemfile is '4.2.7.1' The system suggests to run gem install rmagick -v '2.13.2'

在终端中运行捆绑安装时,出现以下错误:

Installing rmagick 2.13.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/i.k/.rvm/gems/ruby-2.1.2/gems/rmagick-2.13.2/ext/RMagick
/usr/share/rvm/rubies/ruby-2.1.2/bin/ruby -I
/usr/share/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0 -r
./siteconf20200113-25302-1t913rc.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.2. Can't find Magick-config in
/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:/home/i.k/.rvm/gems/ruby-2.1.2/bin:/home/i.k/.rvm/gems/ruby-2.1.2@global/bin:/usr/share/rvm/rubies/ruby-2.1.2/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/usr/share/rvm/bin

*** 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=/usr/share/rvm/rubies/ruby-2.1.2/bin/ruby

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/home/i.k/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/rmagick-2.13.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/home/i.k/.rvm/gems/ruby-2.1.2/gems/rmagick-2.13.2 for inspection.
Results logged to
/home/i.k/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/rmagick-2.13.2/gem_make.out

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

In Gemfile:
  rmagick

[运行C0时出现以下错误

gem install rmagick -v'2.13.2' --source 'https://rubygems.org/'

我已经尝试过以下方法:

Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. current directory: /home/i.k/.rvm/gems/ruby-2.1.2/gems/rmagick-2.13.2/ext/RMagick /usr/share/rvm/rubies/ruby-2.1.2/bin/ruby -I /usr/share/rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0 -r ./siteconf20200114-15956-1hlaeuw.rb extconf.rb checking for Ruby version >= 1.8.5... yes checking for gcc... yes checking for Magick-config... no Can't install RMagick 2.13.2. Can't find Magick-config in /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:/home/i.k/.rvm/gems/ruby-2.1.2/bin:/home/i.k/.rvm/gems/ruby-2.1.2@global/bin:/usr/share/rvm/rubies/ruby-2.1.2/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/usr/share/rvm/bin *** 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=/usr/share/rvm/rubies/ruby-2.1.2/bin/ruby To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/i.k/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/rmagick-2.13.2/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/i.k/.rvm/gems/ruby-2.1.2/gems/rmagick-2.13.2 for inspection. Results logged to /home/i.k/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/rmagick-2.13.2/gem_make.out 已安装0颗宝石-无结果

sudo apt install imagemagick libmagickcore-dev libmagickwand-dev已安装0颗宝石-无结果

sudo apt install libmagickcore-dev当我运行gem rmagick install时没有任何反应-错误保持不变

UPD。mkmf.log说:

PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"

任何帮助将不胜感激

virtual-machine ubuntu-18.04 rmagick ruby-on-rails-4.2
1个回答
0
投票

我实际上知道了。这对我的特殊情况有所帮助。谁知道,它可能会对其他人有所帮助。在项目目录中,我这样做了。

首先我运行find_executable: checking for Magick-config... -------------------- no -------------------- Can't install RMagick 2.13.2. Can't find Magick-config in /home/i.k/.rvm/gems/ruby-2.1.2/bin:/home/i.k/.rvm/gems/ruby-2.1.2@global/bin:/usr/share/rvm/rubies/ruby-2.1.2/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/usr/share/rvm/bin 以确保我拥有它并且它位于应该存在的位置。

第二我跑了locate libMagick

我还在终端中运行了locate Magick-config,以确保我拥有Imagemagic并检查其版本。

为了安全起见,有人认为它并不总是预先安装在Ubuntu上,我还用[]检查了convert -version

make

通常安装在find / -iname "make" 2>/dev/null中,我的是。

建议作为带有PATH变量的选项的修补程序如下所示:

/usr/bin/make

对于已经处理了一天或更多时间的人来说,这可能很容易,但是对于新手来说,这可能会很棘手。

因此请确保比较您拥有的ImageMagick的版本,并在此PATH命令中对其进行相应的更新。

也要区分大小写,在我的情况下,“ Q”不是大写字母“ Q”,而是一个小写字母。我在Magick-config的位置路径中找到了它(请参阅上面运行的命令)。

因此,我的PATH看起来像这样:PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"

所以我运行了PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16:$PATH"以清除所有缓存,然后在终端和瞧中运行了正确的PATH命令。如果有人想添加任何内容或根据我的逻辑纠正我,请这样做,我们欢迎您提出所有意见。

© www.soinside.com 2019 - 2024. All rights reserved.