0

I've got the following problem with ruby on rails v 5.1.6 (Ruby version 2.5.0), the most of the time I try to run the command bundle install on a rails project downloaded from github, I get the following error.

Fetching gem metadata from http://rubygems.org/..........
Using rake 0.8.7z
Using abstract 1.0.0
Using activesupport 3.0.7
Using builder 2.1.2
Using i18n 0.5.0
Using activemodel 3.0.7
Using erubis 2.6.6
Using rack 1.2.8
Using rack-mount 0.6.14
Using rack-test 0.5.7
Using tzinfo 0.3.37
Using actionpack 3.0.7
Using mime-types 1.23
Using polyglot 0.3.3
Using treetop 1.4.14
Using mail 2.2.20
Using actionmailer 3.0.7
Using arel 2.0.10
Using activerecord 3.0.7
Using activeresource 3.0.7

Using addressable 2.3.4
Fetching json 1.8.0
    Installing json 1.8.0 with native extensions
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/daniele/.rvm/gems/ruby-2.5.0/gems/json-1.8.0/ext/json/ext/generator
/home/daniele/.rvm/rubies/ruby-2.5.0/bin/ruby -r ./siteconf20180512-28287-pzwgum.rb extconf.rb
creating Makefile

current directory: /home/daniele/.rvm/gems/ruby-2.5.0/gems/json-1.8.0/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /home/daniele/.rvm/gems/ruby-2.5.0/gems/json-1.8.0/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                               ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast
[-Wint-conversion]
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                    ^
generator.c: In function ‘generate_json’:
generator.c:840:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
     } else if (klass == rb_cFixnum) {
                         ^
generator.c:840:25: note: each undeclared identifier is reported only once for each function it
appears in
generator.c:842:25: error: ‘rb_cBignum’ undeclared (first use in this function)
     } else if (klass == rb_cBignum) {
                         ^
generator.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
Makefile:241: set di istruzioni per l'obiettivo "generator.o" non riuscito
make: *** [generator.o] Errore 1

make failed, exit code 2

Gem files will remain installed in /home/daniele/.rvm/gems/ruby-2.5.0/gems/json-1.8.0 for
inspection.
Results logged to
/home/daniele/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/json-1.8.0/gem_make.out

An error occurred while installing json (1.8.0), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.0'` succeeds before bundling.

In Gemfile:
  airbrake was resolved to 3.1.12, which depends on
    json

What Could the error be? How can I fix it? Thanks for helping.

Joe
  • 41,484
  • 20
  • 104
  • 125
cricket
  • 21
  • 5
  • I am not sure but Json 1.8.0 is a 5 year old gem (may 2013). It may not be compatible with Ruby 2.5.0 See this github issue raised https://github.com/flori/json/issues/303 You may use RVM to install different Ruby versions and switch to an old Ruby version when you download an old Repo from Github (if you develop under Windows it may be really cumbersome, if you develop under Linux / Ubuntu it may be a simple task) – Maxence May 12 '18 at 23:15
  • Are you sure you have a Rails 5.1.6 project running on Ruby 2.5.0? There version numbers in your output tell that it uses Rails 3.0.7. Please double check the required versions and post your `Gemfile`. – spickermann May 13 '18 at 07:01
  • I will try with other versions of ruby because the projects that i am been trying were old(like 3 years old or mote), i've got linux by the way [@Maxence]. When i run rails -v, it says Rails 5.1.6. [@spickermann] Thanks for helping. – cricket May 13 '18 at 10:22

0 Answers0