gem install ffi-yajl causes `undefined method include_path` error - ruby

I am getting the following error while trying to install ffi-yajl
Using berkshelf 4.3.3
Installing ffi-yajl 2.4.0 with native extensions
STDERR: Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/var/lib/gems/2.5.0/gems/ffi-yajl-2.4.0/ext/ffi_yajl/ext/encoder
/usr/bin/ruby2.5 -r ./siteconf20210628-15489-1ggpxn5.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=/usr/bin/$(RUBY_BASE_NAME)2.5
extconf.rb:9:in <main>': undefined method include_path' for Libyajl2:Module
(NoMethodError)
Did you mean? include
extconf failed, exit code 1
It seems to be this line that is failing:
https://github.com/chef/ffi-yajl/blob/master/ext/ffi_yajl/ext/encoder/extconf.rb#L9
unfortunately my knowledge of Ruby is very limited and I don't know if 'include_path' should be defined and if it should then why it is not defined.
Thanks

This should help you.
Here are the steps:
sudo apt remove ruby
Install ruby https://tecadmin.net/install-ruby-latest-stable-centos/#
try gem install again
Source: https://github.com/chef/ffi-yajl/issues/91

Related

extconf.rb:10:in `<main>': uninitialized constant Config (NameError) when `gem install nokogiri -v '1.5.0'`

When I run gem install nokogiri -v '1.5.0', I got the following error.
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /Users/someone/.rvm/gems/ruby-2.6.5/gems/nokogiri-1.5.0/ext/nokogiri
/Users/someone/.rvm/rubies/ruby-2.6.5/bin/ruby -I /Users/someone/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0 -r ./siteconf20200620-16406-16bp1ha.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
--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=/Users/someone/.rvm/rubies/ruby-2.6.5/bin/$(RUBY_BASE_NAME)
extconf.rb:10:in `<main>': uninitialized constant Config (NameError)
Did you mean? RbConfig
CONFIG
extconf failed, exit code 1
Gem files will remain installed in /Users/someone/.rvm/gems/ruby-2.6.5/gems/nokogiri-1.5.0 for inspection.
Results logged to /Users/someone/.rvm/gems/ruby-2.6.5/extensions/x86_64-darwin-18/2.6.0/nokogiri-1.5.0/gem_make.out
It looks like I have to modify the extconf.rb file. But where do I find that file?
Try installing newer version:
gem install nokogiri -v 1.6.8

gem install ruby-debug19 - *** extconf.rb failed ***

I recently blew away and re-installed rvm to fix some issues.
Now, however, when I try and install ruby-debug19 I get:
$ gem install ruby-debug19
... then ...
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug19:
ERROR: Failed to build gem native extension.
/Users/snowcrash/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150619-25075-s8ve57.rb extconf.rb
checking for vm_core.h... no
*** 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=/Users/snowcrash/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
/Users/snowcrash/.rvm/gems/ruby-2.2.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:39:in `create_makefile_with_core': uninitialized constant Ruby_core_source::Config (NameError)
from extconf.rb:19:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/snowcrash/.rvm/gems/ruby-2.2.1/gems/linecache19-0.5.12 for inspection.
Results logged to /Users/snowcrash/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/linecache19-0.5.12/gem_make.out
And the log just contains these lines.
Any suggestions?
ruby-debug19 only works on Ruby 1.9. For Ruby 2.0 and above use byebug.
gem install byebug

Installing Ruby Gem Not working on OSX 10.10 Yosemite

I am trying to install Github Linguist ruby gem through terminal in Mac .
I don't have enough points to upload image so please bear with me.
This is error it is showing when I install it in terminal :-
bash-3.2# gem install github-linguist
Building native extensions. This could take a while...
ERROR: Error installing github-linguist:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150321-444-15aw05d.rb extconf.rb
checking for gmake... no
checking for make... yes
checking for cmake... no
ERROR: CMake is required to build Rugged.
* 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--use-system-libraries
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/rugged-0.22.1b1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/rugged-0.22.1b1/gem_make.out
brew install cmake should do the trick
I know you are not asking how to manager Ruby's versions.
but starting to use RVM will help a lot.

Ruby missing taglib error

On my Ubuntu 14.04 I installed Ruby 2.2.0 using RVM.
I have installed the "taglib" using following command sudo apt-get install libtag1-dev.
However when I try to install a gem I get the following error:
> gem install stream2tracks
Building native extensions. This could take a while...
ERROR: Error installing stream2tracks:
ERROR: Failed to build gem native extension.
/home/dash/.rvm/rubies/ruby-2.2.0-dev/bin/ruby -r ./siteconf20150207-2313-h67sa7.rb extconf.rb
checking for ruby.h... yes
checking for taglib/tag_c.h... no
*** 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/dash/.rvm/rubies/ruby-2.2.0-dev/bin/$(RUBY_BASE_NAME)
extconf failed, exit code 1
Gem files will remain installed in /home/dash/.rvm/gems/ruby-2.2.0-dev/gems/taglib2-0.1.5 for inspection.
You need to install libtagc0-dev to get TagLib's C header (the one the gem is checking for).

intalling linecache-0.46 gem(I am using rbenv)

While bundle install the error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/launchpad/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
Can't handle 1.9.x yet
* 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/launchpad/.rbenv/versions/1.9.3-p448/bin/ruby
Gem files will remain installed in /home/launchpad/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/linecache-0.46 for inspection.
Results logged to /home/launchpad/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/linecache-0.46/ext/gem_make.out
An error occurred while installing linecache (0.46), and Bundler cannot continue.
Make sure that gem install linecache -v '0.46' succeeds before bundling.
You are seeing the error "Can't handle 1.9.x yet" because the linecache gem is not compatible with Ruby 1.9.x. It looks like you are using Ruby 1.9.3-p44.
There is another gem called linecache19 that you can try that is compatible with 1.9.x.
Alternatively, you can:
Use an older version of Ruby via rbenv
Eliminate whatever gem you are trying to use that requires this gem (e.g. ruby-debug)
For more information, look at this question

Resources