无法在Ubuntu中安装rmagick gem(已成功安装ImageMagick)

时间:2022-05-11 09:00:47

Trust me when I tell you I've read each and every single thing on Stack related to this question (I know a few others have asked this).

相信我,当我告诉你我已经阅读了Stack上与此问题相关的每一件事(我知道其他一些人已经问过这个问题)。

OS: Ubuntu 10.04 Ruby: 1.8.7

操作系统:Ubuntu 10.04 Ruby:1.8.7

I installed the latest build of ImageMagick by following their guidelines. I had a couple of problems, but was able to solve them and ultimately managed to get the 'test' command to spit out the correct result (i.e. convert logo: filename.png -- which successfully changed the png file I gave it into a logo of ImageMagick, thus affirming that ImageMagick is installed correctly).

我按照他们的指导安装了最新版本的ImageMagick。我有几个问题,但能够解决它们并最终设法得到'test'命令来吐出正确的结果(即转换logo:filename.png - 它成功地改变了我给它的png文件ImageMagick的标识,因此肯定ImageMagick安装正确)。

Now when I do sudo gem install rmagick I get the following result:

现在,当我做sudo gem install rmagick时,我得到以下结果:

Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension.

构建原生扩展。这可能需要一段时间...错误:安装rmagick时出错:错误:无法构建gem原生扩展。

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

/usr/bin/ruby1.8 extconf.rb extconf.rb:1:在`require'中:没有要加载的文件 - 来自extconf.rb的mkmf(LoadError):1

Gem files will remain installed in /var/lib/gems/1.8/gems/rmagick-2.13.1 for inspection. Results logged to /var/lib/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

Gem文件将保留在/var/lib/gems/1.8/gems/rmagick-2.13.1中以供检查。结果记录到/var/lib/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

Would be eternally grateful for some assistance on this.

会永远感激对此的一些帮助。

Thank you.

2 个解决方案

#1


2  

The error indicates you need mkmf.rb which is part of the ruby1.8-dev package.

该错误表明您需要mkmf.rb,它是ruby1.8-dev软件包的一部分。

Try sudo apt-get install ruby1.8-dev and sudo apt-get install libmagickwand-dev. Hopefully it should work after that.

试试sudo apt-get install ruby​​1.8-dev和sudo apt-get install libmagickwand-dev。希望它应该在那之后工作。

#2


1  

I managed to solve the problem, finally.

我终于设法解决了这个问题。

I added this to my .bashrc file (to pick-up MagickCore.pc):

我把它添加到我的.bashrc文件中(以获取MagickCore.pc):

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"

I then created two symlinks:

然后我创建了两个符号链接:

ln -s /usr/local/include/ImageMagick/wand /usr/local/include/wand ln -s
/usr/local/include/ImageMagick/magick /usr/local/include/magick

After this I was able to install rmagick by simply typing gem install rmagick.

在此之后我只需输入gem install rmagick即可安装rmagick。

Hope this helps someone.

希望这有助于某人。

Cheers.

#1


2  

The error indicates you need mkmf.rb which is part of the ruby1.8-dev package.

该错误表明您需要mkmf.rb,它是ruby1.8-dev软件包的一部分。

Try sudo apt-get install ruby1.8-dev and sudo apt-get install libmagickwand-dev. Hopefully it should work after that.

试试sudo apt-get install ruby​​1.8-dev和sudo apt-get install libmagickwand-dev。希望它应该在那之后工作。

#2


1  

I managed to solve the problem, finally.

我终于设法解决了这个问题。

I added this to my .bashrc file (to pick-up MagickCore.pc):

我把它添加到我的.bashrc文件中(以获取MagickCore.pc):

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"

I then created two symlinks:

然后我创建了两个符号链接:

ln -s /usr/local/include/ImageMagick/wand /usr/local/include/wand ln -s
/usr/local/include/ImageMagick/magick /usr/local/include/magick

After this I was able to install rmagick by simply typing gem install rmagick.

在此之后我只需输入gem install rmagick即可安装rmagick。

Hope this helps someone.

希望这有助于某人。

Cheers.