Reputation: 316
I get the following error when trying to do bundle install or even gem install json -v '1.8.1'
Installing json 1.8.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
/home/noname/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160109-4872-1jxs5yc.rb extconf.rb
creating Makefile
current directory: /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.1/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 [enabled by default]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.1 for inspection.
Results logged to /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/json-1.8.1/gem_make.out
Ruby Version: 2.3.0 and Rails Version: 4.0.3
I tried the solution as suggested here, but that didnt work either. Please if someone has knowledge of this issue or has fixed this issue in the past could help me out.
Upvotes: 1
Views: 1605
Reputation: 21
If the above solution in the link didn't workout for you, please try installing these two
sudo apt-get install libgmp3-dev
sudo apt-get install libruby2.3
let me know if this works
Upvotes: 1
Reputation: 775
After trying everything, the solution for me were the next commands:
rvm get head
rvm –force install 2.3.0 # put your version of ruby
rvm use 2.3.0 # the same version as above
gem install bundle
gem install rails
Upvotes: 0