uninitialized constant Config (NameError) while installing gem for ruby version >= 2.2.x
gem install rbhive Fetching: thrift-0.9.0.gem (100%) Building native extensions. This could take a while... ERROR: Error installing rbhive: ERROR: Failed to build gem native extension.
/home/jyothu/.rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20170628-12526-wz2lr4.rb extconf.rb
*** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/jyothu/.rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
extconf.rb:25:in `
The reason behind this is,
Using ::Config for detecting the various config settings which are populated into node[:languages][:ruby] has been deprecated since 1.9.3. In ruby 2.2.0, this has been removed. Now its ::RbConfig.
For anyone else that comes here looking for an answer like me, the issue is that the thrift dependency (v0.9) currently can't compile with a Ruby version >= 2.2, but the publicly available version of this rbhive gem still requires it. Instead, you need to use gem install rbhive -v 1.0.3.pre or for a Gemfile gem 'rbhive', '~> 1.0.3.pre' in order to get a newer version of rbhive that uses thrift v0.11, which installs fine.