windows windows下的rmagick
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4989097/
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
rmagick under windows
提问by Joern Akkermann
I just wanted to install rmagick under windows.
我只是想在 windows 下安装 rmagick。
So I installed ImageMagick with C/C++ header, but that seems no more to be necessary.
所以我安装了带有 C/C++ 头文件的 ImageMagick,但这似乎没有必要了。
Then I installed the Ruby Build Tools
然后我安装了 Ruby Build Tools
ruby dk.rb init
ruby dk.rb install
Then I wanted to install the rmagick gem with gem install rmagick
.
然后我想用gem install rmagick
.
But I get this error:
但我收到此错误:
H:\Downloads\ruby build tools>gem install rmagick
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... 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=C:/Ruby192/bin/ruby
C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate
an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1
for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Before I installed the Build Tools, I just got the advice to install them.
在我安装构建工具之前,我只是得到了安装它们的建议。
Now they are installed and I get a different error message than before (see above).
现在它们已安装,我收到与以前不同的错误消息(见上文)。
It still wants me to install the Build Tools, so its installation might be broken?
它仍然要我安装构建工具,所以它的安装可能会损坏?
I get the same error with linecache... also something with the mkmf file and build tools.
我在使用 linecache 时遇到了同样的错误......还有一些与 mkmf 文件和构建工具有关的错误。
I guess this is a common error.
我想这是一个常见的错误。
采纳答案by Darme
I installed ImageMagick and RMagick on Windows Vistain a Railsenvironment this way:
我通过以下方式在Rails环境中的Windows Vista上安装了 ImageMagick 和 RMagick :
First I downloaded ImageMagick-6.6.7-Q16from http://www.imagemagick.org/download/binaries/and installed it in "C:\ImageMagick-6.6.7-Q16" folder.
首先,我从http://www.imagemagick.org/download/binaries/下载了ImageMagick-6.6.7-Q16并将其安装在“C:\ImageMagick-6.6.7-Q16”文件夹中。
Then I downloaded RMagick from https://github.com/rmagick/rmagick/zipball/masterand extracted it into "C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\bundler\gems\rmagick-rmagick\" folder (which is my ruby bundler gems folder).
然后我从https://github.com/rmagick/rmagick/zipball/master下载了 RMagick并将其解压到“C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\bundler\gems\rmagick- rmagick\" 文件夹(这是我的 ruby bundler gems 文件夹)。
Then I simply called
然后我简单地打电话
'gem install rmagick'
from my prompt and it all worked fine.
根据我的提示,一切正常。
Now I can call from a Rails app Gemfile
现在我可以从 Rails 应用 Gemfile 调用
gem "rmagick"
And then 'bundle install' works fine.
然后“捆绑安装”工作正常。
PS: please note that I first installed Rails with http://www.railsinstaller.org.
PS:请注意,我首先通过http://www.railsinstaller.org安装了 Rails 。
回答by Bogdan Varlamov
I had to install Ruby on Rails first, and then from the Command Prompt with Ruby and Rails, I ran:
我必须先安装 Ruby on Rails,然后从带有 Ruby 和 Rails 的命令提示符运行:
gem install rmagick --platform=ruby -- --with-opt-dir=C:\ImageMagick
gem install rmagick --platform=ruby -- --with-opt-dir=C:\ImageMagick
It all worked, and I saw this:
这一切都奏效了,我看到了这一点:
Fetching: rmagick-2.13.2.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.2
1 gem installed
Installing ri documentation for rmagick-2.13.2...
Installing RDoc documentation for rmagick-2.13.2...
Windows 7 64bit, but installed the 32-bit version of ImageMagick to C:\ImageMagick
Windows 7 64 位,但将 32 位版本的 ImageMagick 安装到 C:\ImageMagick
回答by Vertex
I got also the same error checking for stdint.h...
The problem was that I've installed ImageMagick on C:\Program Files (x86)\ImageMagick
which contains spaces. So I deinstall ImageMagick and installed again to C:\Ruby19\ImageMagick
.
我也遇到了同样的错误checking for stdint.h...
问题是我已经安装了C:\Program Files (x86)\ImageMagick
包含空格的ImageMagick 。所以我卸载了 ImageMagick 并再次安装到C:\Ruby19\ImageMagick
.
Here is what I've done (Ruby 1.9.3, mingw32)
这是我所做的(Ruby 1.9.3,mingw32)
- Download ImageMagick-6.7.7-9-Q8-windows-dll.exe(the newest version of ImageMagick seems to be incompatible with rmagick)
- Install to
C:\Ruby19\ImageMagick
. The path must not contain spaces! - Set install configuration to
- Add application direcotry to your system path
- Install development headers and libraries for C and C++
gem install rmagick --platform=ruby -- --with-opt-dir=C:\Ruby19\ImageMagick
- 下载ImageMagick-6.7.7-9-Q8-windows-dll.exe(最新版本的ImageMagick好像和rmagick不兼容)
- 安装到
C:\Ruby19\ImageMagick
. 路径不能包含空格! - 将安装配置设置为
- 将应用程序目录添加到您的系统路径
- 安装 C 和 C++ 的开发头文件和库
gem install rmagick --platform=ruby -- --with-opt-dir=C:\Ruby19\ImageMagick
回答by Wirror Yin
Include the head files & lib files to your System Environment first:
首先将头文件和 lib 文件包含到您的系统环境中:
set CPATH=C:/Progra~2/ImageMagick-6.7.0-Q16/include
set LIBRARY_PATH=C:/Progra~2/ImageMagick-6.7.0-Q16/lib
Them, gem install ** will be done. ~.~
他们, gem install ** 将完成。~.~
回答by zetetic
I installed RMagick using these instructions. Note that it calls for Ruby 1.9.1, but works (for me anyway) on 1.9.2 (i386-mingw32). I recommend uninstalling/reinstalling ImageMagick using the version specified in the instructions.
我使用这些说明安装了 RMagick 。请注意,它需要 Ruby 1.9.1,但在 1.9.2 (i386-mingw32) 上工作(无论如何对我来说)。我建议使用说明中指定的版本卸载/重新安装 ImageMagick。
回答by Travis Pessetto
If possible try replacing RMagick with Mini_Magick, it aims to do the same thing but a different way. I had no luck with RMagick but Mini_Magick installed in the bundle
如果可能,请尝试用 Mini_Magick 替换 RMagick,它旨在以不同的方式做同样的事情。我没有使用 RMagick 但 Mini_Magick 安装在捆绑包中