我在安装了ruby软件包的Windows 7上使用cygwin。
$ruby -v
ruby 2.2.5p319 (2016-04-26 revision 54774) [i386-cygwin]
当我运行以下命令gem install json
时,除了json之外我所安装的所有其他包装都没问题。
$ gem install json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: /home/firstname_lastname/.gem/ruby/gems/json-2.0.2/ext/json/ext/generator
/usr/bin/ruby.exe -r ./siteconf20160825-17572-1vtybn6.rb extconf.rb
creating Makefile
current directory: /home/firstname_lastname/.gem/ruby/gems/json-2.0.2/ext/json/ext/generator
make "DESTDIR=" clean
rm -f
rm -f generator.so *.o *.bak mkmf.log .*.time
current directory: /home/firstname_lastname/.gem/ruby/gems/json-2.0.2/ext/json/ext/generator
make "DESTDIR="
gcc -I. -I/usr/include/ruby-2.2.0 -I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -DJSON_GENERATOR -ggdb -O2 -pipe -Wimplicit-function-declaration -o generator.o -c generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h:5:18: fatal error: ruby.h: No such file or directory
#include "ruby.h"
^
compilation terminated.
make: *** [Makefile:239: generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/firstname_lastname/.gem/ruby/gems/json-2.0.2 for inspection.
Results logged to /home/firstname_lastname/.gem/ruby/extensions/x86-cygwin/json-2.0.2/gem_make.out
我已经远远地看了一眼解决方案,但碰到了一堵砖墙。
感谢一些帮助!谢谢。
答案 0 :(得分:0)
试试这个
gem update --system 2.0.3
答案 1 :(得分:0)
我也进行了广泛搜索。最后看到我没有在cygwin中安装gcc。 which gcc
告诉我,我正在使用Windows Perl发行版中的一个:/cygdrive/c/Strawberry/c/bin/gcc
。当然,这是行不通的。
因此,在cygwin中安装了 gcc-core 和 gcc-g ++ 之后,它就像是一种魅力。