Ruby &引用;rmagick“;gem安装问题
我在centos上安装“rmagick”gem时遇到问题。下面是我的输出。有人能帮我确认一下我丢失了什么包裹吗?我已经安装了另外一个堆栈溢出线程: 根据以下建议,现在我得到以下输出:Ruby &引用;rmagick“;gem安装问题,ruby,gem,Ruby,Gem,我在centos上安装“rmagick”gem时遇到问题。下面是我的输出。有人能帮我确认一下我丢失了什么包裹吗?我已经安装了另外一个堆栈溢出线程: 根据以下建议,现在我得到以下输出: Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. /usr/local
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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/local/bin/ruby
/usr/local/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:194:in `<main>'
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
gem_make.out的输出与上面的终端输出相同。错误消息显示:
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
看起来您根本没有缺少任何包,您只需告诉pkg config
在哪里可以找到MagickCore.pc
文件来构建扩展名。如果使用yum
安装了包ImageMagick-devel
,则该文件应位于目录/usr/lib/pkgconfig
或/usr/lib64/pkgconfig
中(取决于您的体系结构)。使用此命令检查(从现在起,我假设您在amd64机器上,如果不是这样,请将lib64
替换为lib
):
如果文件在那里,您只需使用以下命令安装rmagick
:
$ PKG_CONFIG_PATH='/usr/lib64/pkgconfig' gem install rmagick
看起来你没有丢失任何包裹。错误消息很重要: 也许您应该添加包含“MagickCore.pc”的目录 到PKG_CONFIG_PATH环境变量 上的几个答案提供了很好的建议。尝试安装
sudo apt-get install libmagickwand-dev imagemagick
在debian(不稳定)上,解决此错误所需的正确软件包是libmagickcore-6.q16 dev
、imagemagick
和libmagickwand-6-headers
我使用
apt file search MagickCore.pc
和apt file search MagickWand.h
为Mac with Brew找到了它们
brew安装imagemagick
然后,gem install imagemagick将顺利运行。正如错误所说,问题是 在pkg配置搜索路径中未找到包MagickCore 这里还提出了解决方案: 将包含
MagickCore.pc
的目录添加到PKG\u CONFIG\u PATH
环境变量中
所以
sudo find / -name MagickCore.pc
brew install imagemagick@6
brew link --force imagemagick@6
gem install rmagick
对于遇到此问题且100%希望安装devkit的windows用户: 安装时,将显示此提示
选择1是不够的。只需按enter键(1和3),就可以正确安装devkit。看起来很有希望,但只在Ubuntu12上使用。04@Sławosz给您:
yum安装ImageMagick-devel-ImageMagick
与yum一起在CentOS 7上工作。谢谢。关于MacOS,请看下面我的答案。谢谢。你的建议奏效了。但是,我现在得到另一个输出(请检查编辑的问题详细信息)。我不确定如何处理“由于某些原因无法创建Makefile,可能缺少必要的库和/或头。有关详细信息,请查看mkmf.log文件。”。另外,我需要安装输出中提到的开发版本吗?嗨,是的,我刚刚确认安装了这个glibc头库。还有其他线索吗?在上面添加了mkmf.log文件的输出。请检查你是否能找到任何线索。我对这些和linux也不熟悉,所以丢失了很多,输出对我来说没有什么意义:(。另外,如果你能给我一个描述性的指南链接来安装RMagick,我可以从头开始,这也会有很大的帮助。不,我没有从源代码编译任何包。我总是使用“yum install”或“gem install”。这个问题的答案是:,你认为对我来说也可能是类似的情况吗?rmagick与imagemagick的不兼容版本?在Ubuntu 16.04上,现在是PATH=“/usr/lib/x86_64-linux-gnu/imagemagick-6.8.9/bin-Q16:$PATH"PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig gem install rmagick-v'2.13.2'如果您使用的是自制软件,并且ImageMagick7有问题,这是正确的答案。brew链接--强制imagemagick@6
帮助我安装gem-dhash。包含的目录意味着您必须删除文件名才能正常工作。因此PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
。当然!谢谢,@sekrett
sudo apt-get install libmagickwand-dev imagemagick
sudo find / -name MagickCore.pc
PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
brew install imagemagick@6
brew link --force imagemagick@6
gem install rmagick