Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing json Ruby gem

I'm running gem install json -v '1.8.1' however I get this error..

gem install json -v '1.8.1'
Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

    current directory: /Users/johnwilliamson/.rvm/gems/ruby-2.4.1/gems/json-1.8.1/ext/json/ext/generator
/Users/johnwilliamson/.rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20170412-72871-wada1h.rb extconf.rb
creating Makefile

current directory: /Users/johnwilliamson/.rvm/gems/ruby-2.4.1/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /Users/johnwilliamson/.rvm/gems/ruby-2.4.1/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                              ^
/Users/johnwilliamson/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0/ruby/intern.h:795:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) RB_GNUC_EXTENSION_BLOCK(   \
        ^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' (aka 'unsigned long (const char *, long)') [-Wint-conversion]
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
          ^        ~~~~~~~~~~
generator.c:840:25: error: use of undeclared identifier 'rb_cFixnum'
    } else if (klass == rb_cFixnum) {
                        ^
generator.c:842:25: error: use of undeclared identifier 'rb_cBignum'
    } else if (klass == rb_cBignum) {
                        ^
1 warning and 3 errors generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/johnwilliamson/.rvm/gems/ruby-2.4.1/gems/json-1.8.1 for inspection.
Results logged to /Users/johnwilliamson/.rvm/gems/ruby-2.4.1/extensions/x86_64-darwin-16/2.4.0/json-1.8.1/gem_make.out

When I run just gem install json it installs fine taking me over version 2 however I'm trying to install this https://github.com/peatio/peatio and it wants that version specifically.

Any other ideas?

like image 664
velua Avatar asked Nov 07 '22 23:11

velua


1 Answers

Finding and updating the gem that is pulling in the JSON gem should work. However, another thing that worked for me was to update the version of JSON being installed.

bundle update json

This worked because it updated JSON to version 1.8.6 which is compatible with newer Rubies.

like image 173
blazerw Avatar answered Nov 15 '22 06:11

blazerw