简体   繁体   中英

trying to install ruby gem json in cygwin

I am using cygwin on windows 7 with ruby package installed.

$ruby -v ruby 2.2.5p319 (2016-04-26 revision 54774) [i386-cygwin]

when i run the following command gem install json all other packeges i've installed work fine except 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

I've looked far and wide for a solution but have hit a brick wall.

Appreciate some assistance! thank you.

试试这个

gem update --system 2.0.3

I've also searched far and wide. In the end saw that I didn't have gcc installed in cygwin. which gcc told me I was using the one from my Windows Perl distribution: /cygdrive/c/Strawberry/c/bin/gcc . This, of course, can't work.

So, after installing gcc-core and gcc-g++ in cygwin, it works like a charm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM