ERROR installing Jekyll: Failed to build gem native extension.
sylhare opened this issue · comments
While trying to install Jekyll on Ubuntu 16.04 32bits. I encountered an error.
Here is what I had:
- gem 2.5.1
- ruby 2.3.1
Trying to run:
gem install jekyll
And here is the error message:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20171002-2379-1byb6u9.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/ffi-1.9.18 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86-linux/2.3.0/ffi-1.9.18/gem_make.out
Ok so you need to install the ruby development headers to install some gem with Ruby-FFI (it is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code).
Solution
You need to install the ruby development package before using gem install jekyll
depending on your distribution it is not named the same:
- For Ubuntu with ruby-dev
sudo apt-get install ruby-dev
- For Fedora with ruby-devel
sudo yum ruby-devel
- For MacOS, make sure that Xcode is installed and licensed is agreed:
xcode-select --install
For other issues linked to nokogiri and native extensions, you can check it out at nokogiri.org
I was getting the same error but got the solution, just go ahead and install ruby-dev and you have got the solution. Cheers!
Command - sudo apt-get install ruby-dev