DynastySS
DynastySS

Reputation: 395

Json gem install fail. Xcode already installed and up to date

I am getting the following errors when trying to run the bundler.

bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Using rake 10.0.4
Using i18n 0.6.1
Using multi_json 1.7.3
Using activesupport 3.2.13
Using builder 3.0.4
Using activemodel 3.2.13
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.5
Using rack-cache 1.2
Using rack-test 0.6.2
Using hike 1.2.2
Using tilt 1.4.1
Using sprockets 2.2.2
Using actionpack 3.2.13
Using mime-types 1.23
Using polyglot 0.3.3
Using treetop 1.4.12
Using mail 2.5.4
Using actionmailer 3.2.13
Using arel 3.0.2
Using tzinfo 0.3.37
Using activerecord 3.2.13
Using activeresource 3.2.13
Using coffee-script-source 1.6.2
Using execjs 1.4.0
Using coffee-script 2.2.0
Using rack-ssl 1.3.3

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/camerons/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150331-784-1yax4yj.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/camerons/.rvm/rubies/ruby-2.2.0/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

Gem files will remain installed in /Users/camerons/.rvm/gems/ruby-2.2.0/gems/json-1.8.0 for inspection.
Results logged to /Users/camerons/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.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.

I try running the gem install json 1.8.0 and get this error.

gem install json -v '1.8.0'
Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

    /Users/camerons/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150331-884-1wle120.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/camerons/.rvm/rubies/ruby-2.2.0/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

Gem files will remain installed in /Users/camerons/.rvm/gems/ruby-2.2.0/gems/json-1.8.0 for inspection.
Results logged to /Users/camerons/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0/json-1.8.0/gem_make.out

I know it isn't xcode because it says it is already installed and I just ran the latest software update on it.

Any advice would be greatly appreciated!

Upvotes: 3

Views: 759

Answers (4)

Jikku Jose
Jikku Jose

Reputation: 18804

Thats because that json version isn't compatible; try modifying the Gemfile to latest gem. See this answer.

Upvotes: 1

Dane Balia
Dane Balia

Reputation: 5367

I had the very same issue and it was because my code (repo) was using an older version of Ruby.

When I cd'd to the directory, I got this message:

furian:Hetzner danebalia$ cd X_installer/
ruby-1.9.3-p194 is not installed.
To install do: 'rvm install ruby-1.9.3-p194'

Upon installation of the missing version of Ruby, the error went away.

Upvotes: 0

Kris Robison
Kris Robison

Reputation: 698

It appears that json-1.8.2 installs cleanly under ruby 2.2.2. I was running into the same issue previously.

Upvotes: 1

Malissa
Malissa

Reputation: 86

This just happened to me today on osx yosemite for the json 1.7.3 gem and I have no idea why. I tried pretty much everything recommended for this problem - setting Archflags, updating command line tools, etc. I believe the project I wanted to run was just too old (gem install json without the version worked just fine) and I gave up on it. I frankly have no idea why bundle install was trying to load json 1.7.3 anyways.

Try using gemsets to keep all of your app dependencies separate from one another. Sometimes that fixes the problem.

rvm gemset create [some name]
rvm gemset use [some name]
bundle install

I hope this helps! I know it's not really an answer but stackoverflow won't let me comment until I have more reputation points. I'll be following your question to see if anyone can give you an answer.

Upvotes: 1

Related Questions