Reputation: 749
OS: Mac OS X 10.10.3 XCode: Latest with command line tools installed (version 6.3) Rails: version 4.2.1 Ruby: version 2.2.1
I was trying to generate the routes for a project I am working on (been doing that on regular basis), when I got an error message, with a recommendation that I do bundle install and bundle exec. I did, and this time around, the process broke off while compiling the JSON Gem (version 1.7.7).
Doing some research on StackOverflow, the recommendation was to update the Xcode's command line tools, and I did, but that did not solve the problem.
I tried installing the JSON version 1.7.7 separately, and it failed, telling me to look for the error log in:
/Users/zwb/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150411-36070-1t083xl.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
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/zwb/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:793:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) __extension__ ( \
^
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)' [-Wint-conversion]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^ ~~~~~~~~~~
1 warning and 1 error generated.
make: *** [generator.o] Error 1
make failed, exit code 2
Upvotes: 36
Views: 37505
Reputation: 9747
Sad, however, JSON-1.7.7 (and upto 1.8.1) is incompatible with Ruby-2.2.x. As you are using Ruby-2.2.1, it will not work for you.
There are 2 options for you:
json
gem to 1.8.2
version. -- Preferableruby-2.2.1/ext/json/fbuffer/fbuffer.h
file and replace problematic code with VALUE result = rb_str_new(FBUFFER_PTR(fb), FBUFFER_LEN(fb));
. Look here for detailsUpvotes: 64
Reputation: 11810
I encountered this problem as well, and none of the suggested fixes here solved it.
I was only able to resolve it by manually re-downloading and re-installing the appropriate version of the Xcode command line tools:
https://developer.apple.com/download/more/?name=command%20line%20tools
Upvotes: 0
Reputation: 2132
This worked for me, since I downloaded basic Ruby by accident.
Install the Ruby "Development Kit" here: http://rubyinstaller.org/downloads/ Click the self-extracting file, and extract it here:
(or somewhere else, but I had problems in other directories)
Open the cmd (terminal):
cd C:\RubyDevKit
ruby dk.rb init
ruby dk.rb install
Source: http://jekyll-windows.juthilo.com/1-ruby-and-devkit/
Upvotes: 0
Reputation: 679
If you are using Ruby 2.2.0 or greater, the json gem will not compile properly. You can fix this by issuing bundle update json
Upvotes: 56