I am trying to run an open source web app on my local machine(Ubuntu 15.10). When I run bundle command I'm getting this
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/yesh/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/home/yesh/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20170310-4319-tlc92v.rb
extconf.rb
creating Makefile
current directory:
/home/yesh/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean
current directory:
/home/yesh/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
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’
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: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/home/yesh/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3 for
inspection.
Results logged to
/home/yesh/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/json-1.8.3/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot
continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
So I tried gem install json -v '1.8.3' but again got the same error message as above. Please help in resolving this.
I think you can solve your problem as:
sudo apt-get install libgmp3-dev
and if above command didn't solve your system, you can try to install this command:
sudo apt-get install libgmp-dev
You can refer at json-1.8.3 Gem::Ext::BuildError
Because your ruby version is 2.4.0.The ruby version is not compatible with json 1.8.3. You can try add this line in your Gemfile:
gem 'json', github: 'flori/json', branch: 'v1.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