Closed crsuarez closed 6 years ago
you're trying to install ffi-yajl 1.4.0, the current version is 2.3.1.
Also happens with 2.2.2
user@user-VirtualBox:~/chef-browser$ cat /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/ffi-yajl-2.2.2/gem_make.out
current directory: /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ffi-yajl-2.2.2/ext/ffi_yajl/ext/encoder
/home/user/.rbenv/versions/2.5.0/bin/ruby -r ./siteconf20180411-11583-1nik0k1.rb extconf.rb
-I/home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/include $(cflags)
-L/home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/lib -L. -L/home/user/.rbenv/versions/2.5.0/lib -fstack-protector -rdynamic -Wl,-export-dynamic
checking for yajl/yajl_tree.h... yes
creating Makefile
current directory: /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ffi-yajl-2.2.2/ext/ffi_yajl/ext/encoder
make "DESTDIR=" clean
current directory: /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ffi-yajl-2.2.2/ext/ffi_yajl/ext/encoder
make "DESTDIR="
compiling encoder.c
encoder.c: In function ‘gen_number’:
encoder.c:109:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
char *cptr = RSTRING_PTR(str);
^
encoder.c: In function ‘rb_cNilClass_ffi_yajl’:
encoder.c:262:30: warning: passing argument 2 of ‘gen_cstring’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
gen_cstring(rb_yajl_gen, "", sizeof("")-1);
^
encoder.c:79:7: note: expected ‘char *’ but argument is of type ‘const char *’
VALUE gen_cstring(VALUE rb_yajl_gen, char *cptr, int len) {
^
encoder.c: In function ‘rb_cTrueClass_ffi_yajl’:
encoder.c:272:30: warning: passing argument 2 of ‘gen_cstring’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
gen_cstring(rb_yajl_gen, "true", sizeof("true")-1);
^
encoder.c:79:7: note: expected ‘char *’ but argument is of type ‘const char *’
VALUE gen_cstring(VALUE rb_yajl_gen, char *cptr, int len) {
^
encoder.c: In function ‘rb_cFalseClass_ffi_yajl’:
encoder.c:282:30: warning: passing argument 2 of ‘gen_cstring’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
gen_cstring(rb_yajl_gen, "false", sizeof("false")-1);
^
encoder.c:79:7: note: expected ‘char *’ but argument is of type ‘const char *’
VALUE gen_cstring(VALUE rb_yajl_gen, char *cptr, int len) {
^
encoder.c: In function ‘Init_encoder’:
encoder.c:366:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
ID sym_Date = rb_intern("Date");
^
encoder.c:368:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
ID sym_Time = rb_intern("Time");
^
encoder.c:370:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
ID sym_DateTime = rb_intern("DateTime");
^
encoder.c:372:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
ID sym_StringIO = rb_intern("StringIO");
^
encoder.c:380:20: error: ‘rb_cFixnum’ undeclared (first use in this function)
rb_define_method(rb_cFixnum, "ffi_yajl", rb_cFixnum_ffi_yajl, 2);
^
encoder.c:380:20: note: each undeclared identifier is reported only once for each function it appears in
encoder.c:381:20: error: ‘rb_cBignum’ undeclared (first use in this function)
rb_define_method(rb_cBignum, "ffi_yajl", rb_cBignum_ffi_yajl, 2);
^
encoder.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
Makefile:241: recipe for target 'encoder.o' failed
make: *** [encoder.o] Error 1
make failed, exit code 2
again: "the current version is 2.3.1"
For people trying to build old versions of chef on a new version or ruby and you feel you're blocked because of ffi-yajl.
You can't do that.
You have to bundle install chef onto the version of chef which it was shipped on.
This is a major reason why we push people towards using the omnibus-chef and omnibus-chefdk packages to sort this out (and the whole point of those is that we can decisively say 'no' to these kinds of support requests).
For consumers as a gem to bundle install you must use the correct ruby version to test against (for any number of reasons) which as an example in travis looks like:
https://github.com/poise/halite/blob/07ccd6d14cda75ce6e78e4ad8055a88bdb89efe5/.travis.yml#L6-L31
A more involved example that we had to use ourselves:
https://github.com/chef-boneyard/compat_resource/blob/master/.travis.yml#L23-L56
This gem install is just the first failure you're likely to hit. You will also be missing the patches that went directly into the chef-client to fix bugs, along with any other issues around gem dependencies. So even if we attempted to fix this repo it wouldn't help you, it would just let you get further down a road that is completely unsupported.
The two solutions are to pin your ruby onto an old version that matches the chef version, or to upgrade your chef version. You can't take old chef and expect to run it on new ruby.