[version information]
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux] / gem 2.0.3 / Windows 10
I ran bundle install
and it told me to run gem install json -v '1.8.3'
I did that and got a Failed to build gem native extension error.
Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension. /home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb creating Makefile make compiling generator.c generator.c: In function ‘generate_json’: generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function) } else if (klass == rb_cFixnum) { ^ generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in generator.c:863: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" [enabled by default] cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default] cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default] cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default] make: *** [generator.o] Error 1 Gem files will remain installed in /home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3 for inspection. Results logged to /home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
I've checked several documents. I installed Devkit and json 1.8.5 but my project keeps the message that "install json 1.8.3" How can I solve this problem??
/home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3
contains:
../ ./ data/ diagrams/ ext/ java/ lib/ tests/ tools/ install.rb* .gitignore .travis.yml CHANGES COPYING COPYING-json-jruby GPL Gemfile README-json-jruby.markdown README.rdoc Rakefile
/home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
contains:
user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out /home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb creating Makefile make compiling generator.c generator.c: In function ‘generate_json’: generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function) } else if (klass == rb_cFixnum) { ^ generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in generator.c:863: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" [enabled by default] cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default] cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default] cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default] make: *** [generator.o] Error 1
Try removing the Gemfile.lock and running the bundle command again. It should be using a different version of json (ie. 1.8.6) without a problem.
I ran into the same issue recently as well, try and see if there's a newer version of whatever gem you're using that depends on json 1.8.3. This is happening because Ruby 2.4 unified Fixnum and Bignum into Integer. If you're able to upgrade to json 1.8.5 or higher, it should help fix your problems.
You could also try and update the gem you're using and try to relax the version constraints (I've found this to work with a lot of projects, but not all) like so:
gem 'json', '>= 1.8'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With