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

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
30/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
ruby
Domain
documentation

Research direction

No target file, test, or entry point is named. Start by locating the repository's Chef installation documentation and compare it with the reported Ruby 2.2.2/json-1.6.1 failure and workaround; done means the exact version combination, failure, and environment-specific workaround are documented.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Ruby
Stars
3
Forks
3
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from engineyard/eydr

All issues in engineyard/eydr

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.