mitchellh/vagrant — Issue #735: (RC) vagrant gem does not install gems with C extensions
Author: jtimberman
Created: 2012-02-13 03:25:51+00:00
State: open

I use Chef::Config in my Vagrantfile, so I need Chef installed in the load path that Vagrant knows about. However, yajl-ruby (dependency of ohai) fails to build.

```
% sudo /opt/vagrant/bin/vagrant gem install chef
zsh: correct 'chef' to '.chef' [nyae]? n
Building native extensions. This could take a while...
ERROR: Error installing chef:
ERROR: Failed to build gem native extension.

/opt/vagrant/embedded/bin/ruby extconf.rb
creating Makefile

make
compiling yajl_version.c
compiling yajl_alloc.c
compiling yajl_buf.c
compiling yajl.c
compiling yajl_parser.c
compiling yajl_gen.c
compiling yajl_ext.c
In file included from /opt/vagrant/embedded/include/ruby-1.9.1/ruby.h:32:0,
from yajl_ext.h:32,
from yajl_ext.c:24:
/opt/vagrant/embedded/include/ruby-1.9.1/ruby/ruby.h:105:14: error: size of array ‘ruby_check_sizeof_long’ is negative
/opt/vagrant/embedded/include/ruby-1.9.1/ruby/ruby.h:109:14: error: size of array ‘ruby_check_sizeof_voidp’ is negative
In file included from /opt/vagrant/embedded/include/ruby-1.9.1/ruby/intern.h:34:0,
from /opt/vagrant/embedded/include/ruby-1.9.1/ruby/ruby.h:1361,
from /opt/vagrant/embedded/include/ruby-1.9.1/ruby.h:32,
from yajl_ext.h:32,
from yajl_ext.c:24:
/opt/vagrant/embedded/include/ruby-1.9.1/ruby/st.h:67:14: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative
yajl_ext.c: In function ‘yajl_encode_part’:
yajl_ext.c:117:21: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
yajl_ext.c: In function ‘yajl_found_hash_key’:
yajl_ext.c:291:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
yajl_ext.c: In function ‘rb_yajl_parser_parse’:
yajl_ext.c:442:17: warning: variable ‘stat’ set but not used [-Wunused-but-set-variable]
make: *** [yajl_ext.o] Error 1

Gem files will remain installed in /home/jtimberman/.vagrant.d/gems/gems/yajl-ruby-1.1.0 for inspection.
Results logged to /home/jtimberman/.vagrant.d/gems/gems/yajl-ruby-1.1.0/ext/yajl/gem_make.out
```

Just to make sure this isn't something weird with yajl-ruby, I got similar results with installing the latest json (v1.6.5, and yes I know, the vagrant package includes a json gem). I couldn't think of another gem with C extensions that wouldn't require shaving a yak to get other libs in place for compiling (e.g., mysql or nokogiri would need extra work just to test this).