engineyard / eydr

EY Disaster Recovery Recipes (Unsupported)
http://www.engineyard.com
3 stars 3 forks source link

(Doc) Chef 10.16.4 install fails w/ Ruby 2.2.2 due to json gem #6

Open jahio opened 9 years ago

jahio commented 9 years ago

Some users attempting to install this exact version combination may run into a problem where the json gem is failing to build. For example:

gem install chef --version="10.16.4"
[snip]
Fetching: json-1.6.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing chef:
        ERROR: Failed to build gem native extension.

    /home/jaustinhughey/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20150529-1424-1rmvbxh.rb extconf.rb
checking for ruby/re.h... yes
checking for ruby/encoding.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
generator.c: In function ‘cState_aref’:
generator.h:134:27: warning: variable ‘state’ set but not used [-Wunused-but-set-variable]
     JSON_Generator_State *state;              \
                           ^
generator.c:736:5: note: in expansion of macro ‘GET_STATE’
     GET_STATE(self);
     ^
generator.c: In function ‘fbuffer_to_s’:
generator.c:952:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                               ^
generator.c:952:20: warning: initialization makes integer from pointer without a cast
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                    ^
Makefile:237: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/jaustinhughey/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/json-1.6.1 for inspection.
Results logged to /home/jaustinhughey/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/json-1.6.1/gem_make.out

In my case I was able to fix this with:

rbenv install 2.1.6
rbenv global 2.1.6
gem install bundler json
rbenv rehash
gem install chef --version="10.16.4"

Note, of course, I'm using rbenv. Modify those commands to suit your Ruby environment manager of choice, or don't forget sudo if you're rolling raw.

kokizzu commented 9 years ago

:+1: