在rails 5.0.0中,我试图运行一个应用程序,但是bundle install无法运行,它显示错误,如
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/XYZ/shruthir/.rvm/gems/ruby-2.3.1/gems/rmagick-2.16.0/ext/RMagick
/home/XYZ/shruthir/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20171012-7699-f2np4k.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for outdated ImageMagick version (<= 6.4.9)... *** 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.
...
Gem files will remain installed in /home/XYZ/shruthir/.rvm/gems/ruby-2.3.1/gems/rmagick-2.16.0 for inspection.
Results logged to /home/XYZ/shruthir/.rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0/rmagick-2.16.0/gem_make.out
An error occurred while installing rmagick (2.16.0), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.16.0'` succeeds before bundling.
In Gemfile:
rmagick
如果我运行gem install rmagick -v '2.16.0'
,则会显示与
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
在谷歌搜索此问题并尝试通过运行sudo apt-get install imagemagick libmagickwand-dev
进行修复,但同样显示错误,如
Err:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libpcre3-dev amd64 2:8.38-3.1
500 Internal Error [IP: 91.189.88.161 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/p/pcre3/libpcre3-dev_8.38-3.1_amd64.deb 500 Internal Error [IP: 91.189.88.161 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
sudo apt-get update
日志就像
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:4 https://deb.nodesource.com/node_6.x xenial InRelease
Hit:5 http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu xenial InRelease
Hit:7 https://repo.skype.com/deb stable InRelease
Hit:8 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Hit:9 http://apt.postgresql.org/pub/repos/apt xenial-pgdg InRelease
Hit:10 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu xenial InRelease
Hit:11 http://ppa.launchpad.net/webupd8team/atom/ubuntu xenial InRelease
Hit:6 http://screenshots.getdeb.net xenial-getdeb InRelease
Hit:12 https://download.sublimetext.com apt/stable/ InRelease
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu xenial-proposed InRelease [253 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 560 kB in 3s (146 kB/s)
Reading package lists... Done
请帮助我解决此rmagick
问题。
答案 0 :(得分:0)
最新方法
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
gem install rmagick
方法1
rmagick gem在安装时无法找到PKG_CONFIG_PATH。我们需要告诉ImageMagick的路径存在于何处。添加bash总是更好。
export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.9.3-7/lib/pkgconfig
方法2
如果上述解决方案无效,请尝试此操作
你只需告诉pkg-config在哪里找到MagickCore.pc文件来构建扩展。如果您使用yum安装了包ImageMagick-devel,则该文件应位于/ usr / lib / pkgconfig或/ usr / lib64 / pkgconfig目录中(取决于您的体系结构)
试试这个
locate /usr/lib64/pkgconfig -name MagickCore.pc
或
find /usr/lib64/pkgconfig -name MagickCore.pc
如果文件在那里,您只需使用以下命令安装rmagick:
PKG_CONFIG_PATH='/usr/lib64/pkgconfig' gem install rmagick