在 Rails 中安装 RMagick-gem 时出现问题
我一整天都在努力学习教程来安装 RMagick,现在我认为已经取得了很大的进展,但偶然发现了一个我真的不知道如何解决的错误,也没有得到任何有用的信息。
当我尝试安装 gem 时,我收到此消息:
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
我认为粗体部分是重要部分,并且我做了一些研究并了解 stdint.h 是某种标头,但我不知道知道如何安装它。
我还检查了 mkmf.log 文件,该文件为我提供了一些易于阅读的信息:
检查 Ruby 版本 >= 1.8.5... ----------------- --- 是的
"gcc -o conftest -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby192/include/ruby-1.9.1/ruby/backward -IC:/Ruby192/include/ruby-1.9.1 -I. -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long conftest.c -L. -LC:/Ruby192/lib -L. -lCORE_RL_magick_ -lX11 -lmsvcrt-ruby191-static -lshell32 -lws2_32 "
cc1.exe: error: unrecognized command line option "-Wno-missing-field-initializers"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */
有人有什么想法吗?
非常感谢您的帮助!
问候,埃米尔
I've been plowing through tutorials all day trying to install RMagick, and have gotten pretty far now I reckon, but have stumbled apon an error that I really don't know how to solve, nor get any useful info on.
When I try to install the gem, I get this message:
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
I suppose that the part in bold is the important part, and I've done some research and have understood that stdint.h is some sort of header, but I don't know how to install it.
I also checked in the mkmf.log file which gave me this easy to read bit of info :
checking for Ruby version >= 1.8.5... -------------------- yes
"gcc -o conftest -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby192/include/ruby-1.9.1/ruby/backward -IC:/Ruby192/include/ruby-1.9.1 -I. -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long conftest.c -L. -LC:/Ruby192/lib -L. -lCORE_RL_magick_ -lX11 -lmsvcrt-ruby191-static -lshell32 -lws2_32 "
cc1.exe: error: unrecognized command line option "-Wno-missing-field-initializers"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */
Anyone have any ideas?
Big thanks in advance for any help!
Regards, Emil
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个:
sudo apt-get install libmagickwand-dev
它适用于 Ubuntu。
Try this out :
sudo apt-get install libmagickwand-dev
It works for Ubuntu.
你是在窗户上吗?如果是,那么很可能,正如您的日志所说,您需要安装 http://rubyforge.org/ frs/?group_id=167 <-- 开发套件,因为一些编译命令不存在...
Are you on windows? If you are, chances are, as ur log said, you need to install http://rubyforge.org/frs/?group_id=167 <-- the development kit since some commands for compiling doesn't exist...
我通过运行“apt-get install libmagick9-dev”来安装 ImageMagicks devkit 解决了这个问题。
I solved this by running 'apt-get install libmagick9-dev' which installs ImageMagicks devkit.