Linux 在 Ubuntu 上安装 rmagick

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3704919/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 23:33:11  来源:igfitidea点击:

Installing rmagick on Ubuntu

rubylinuxubuntuimagemagickrmagick

提问by Ciaran Archer

I'm trying to get RMagick setup on Ubuntu 10.04. Looked herebut had no joy. I even compiled and installed ImageMagick from source, but the instructions herestill didn't help me when I try to install RMagick using RubyGems. I got this error:

我正在尝试在 Ubuntu 10.04 上安装 RMagick。看着这里,但没有快乐。我什至从源代码编译并安装了 ImageMagick,但是当我尝试使用 RubyGems 安装 RMagick 时,这里的说明仍然没有帮助我。我收到此错误:

carcher@carcher-laptop:~/Code/temp/RMagick-2.13.1$ sudo gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
 ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
 from extconf.rb:1


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
carcher@carcher-laptop:~/Code/temp/RMagick-2.13.1$ 

What does it all mean? :) I'm new to Ruby and RubyGems so please be gentle. My setup is as follows:

这是什么意思呢?:) 我是 Ruby 和 RubyGems 的新手,所以请保持温和。我的设置如下:

Ruby: 1.8.7
RubyGems: 1.3.7

I'm pretty much out of ideas (and tired too!). I tired to compile RMagick from source using the link above but it failed as there was no ./configurescript :(

我几乎没有想法(也很累!)。我厌倦了使用上面的链接从源代码编译 RMagick 但它失败了,因为没有./configure脚本:(

Any and all help appreciated!

任何和所有的帮助表示赞赏!

采纳答案by gcahill

Install the packages imagemagickand libmagickwand-dev(or libmagick9-dev). You should then be able to install the Rmagick Gem.

安装软件包imagemagicklibmagickwand-dev(或libmagick9-dev)。然后您应该能够安装 Rmagick Gem。

sudo apt-get install imagemagick libmagickwand-dev

If not, you are missing ruby related development packages like build-essentialand ruby1.8-dev. If that's the case, a generic "ubuntu install ruby 1.8" query in google should sort you out.

如果没有,您将缺少与 ruby​​ 相关的开发包,如build-essentialruby1.8-dev。如果是这种情况,谷歌中的通用“ubuntu install ruby​​ 1.8”查询应该可以解决您的问题。

回答by Peter Lyons

If you want to try installing the native deb package instead of the gem, be aware that the librmagick-ruby was broken on Ubuntu 10.04 until just very recently:

如果你想尝试安装本地 deb 包而不是 gem,请注意 librmagick-ruby 在 Ubuntu 10.04 上直到最近才被破坏:

https://bugs.launchpad.net/ubuntu/+source/librmagick-ruby/+bug/518122

https://bugs.launchpad.net/ubuntu/+source/librmagick-ruby/+bug/518122

See comment #17 in particular. I believe this has already been fixed so now apt-get install librmagick-rubymight "just work". Otherwise here's how to build it yourself from source

特别参见评论#17。我相信这已经解决了,所以现在apt-get install librmagick-ruby可能“正常工作”。否则,这里是如何从源代码自己构建它

$ cd /usr/src
$ sudo apt-get build-dep librmagick-ruby
$ sudo apt-get source librmagick-ruby
$ cd librmagick-ruby-2.11.1
$ sudo dch -i
(add changelog entry)
$ sudo dpkg-buildpackage
$ cd ..
$ sudo dpkg -i librmagick-ruby*.deb

回答by antage

You got message extconf.rb:1:in 'require': no such file to load -- mkmf (LoadError)because package ruby1.8-devisn't installed. Install it (sudo apt-get install ruby1.8-dev) and try again.

您收到消息,extconf.rb:1:in 'require': no such file to load -- mkmf (LoadError)因为ruby1.8-dev未安装软件包。安装它 ( sudo apt-get install ruby1.8-dev) 并重试。

回答by Micha? Szajbe

On Ubuntu 12.04libmagick9-devis gone. graphicsmagick-libmagick-dev-compatshould be used instead.

Ubuntu 12.04libmagick9-dev上消失了。graphicsmagick-libmagick-dev-compat应该改用。

apt-get install graphicsmagick-libmagick-dev-compat

回答by John Griffiths

this worked for me...

这对我有用...

sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev 

gem install rmagick

...

Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed

(ubuntu 12.0.4 64bit)

(Ubuntu 12.0.4 64 位)

回答by Larry

On Ubuntu 12.0.4.2sudo apt-get install libmagickwand-dev libmagickcore-dev libmagickcore4-extra libgraphviz-dev libgvc5worked for me.

Ubuntu 12.0.4.2 上sudo apt-get install libmagickwand-dev libmagickcore-dev libmagickcore4-extra libgraphviz-dev libgvc5为我工作。

graphicsmagick-libmagick-dev-compat installed but didn't include the header files so rmagick wouldn't compile.

graphicsmagick-libmagick-dev-compat 已安装但未包含头文件,因此 rmagick 无法编译。

Please note, you need to remove graphicsmagick-libmagick-dev-compat before running the command above.

请注意,在运行上述命令之前,您需要删除 graphicsmagick-libmagick-dev-compat。

回答by jmontross

To get bundle to stop failing on ubuntu 12.04.

让 bundle 在 ubuntu 12.04 上停止失败。

apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev

This is my gemfile

这是我的 gemfile

gem 'rmagick' 
gem 'mini_magick' 

回答by Daniel X Moore

You don't need a lot of the other junk in these answers, just:

在这些答案中,您不需要很多其他垃圾,只需:

sudo apt-get install libmagickwand-dev

回答by Deepak Lamichhane

In Ubuntu 13.10

在 Ubuntu 13.10 中

This code worked for me

这段代码对我有用

sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev

sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev

gem install rmagick

宝石安装 rmagick

回答by bapu

In Ubuntu 14.04

在 Ubuntu 14.04 中



Below code is worked for me

下面的代码对我有用

sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev

Then,

然后,

gem install rmagick