Issue
I am trying to install Jekyll on Fedora 26 using the command gem install jekyll --user-install
But I receive the following error:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /my_user/.gem/ruby/2.4.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
/usr/bin/ruby -r ./siteconf20180420-21754-1k1q01a.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /my_user/.gem/ruby/2.4.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /my_user/.gem/ruby/2.4.0/extensions/x86_64-linux/2.4.0/http_parser.rb-0.6.0/gem_make.out
I have Ruby installed:
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
And also I updated the Ruby Gems using gem update --system
.
I searched the Stackoverflow, and I found a similar question solved for MacOS.
The output of gem env
is as follows:
RubyGems Environment:
RUBYGEMS VERSION: 2.7.6
RUBY VERSION: 2.4.3 (2017-12-14 patchlevel 205) [x86_64-linux]
INSTALLATION DIRECTORY: /my_user/.gem/ruby/2.4.0
USER INSTALLATION DIRECTORY: /my_user/.gem/ruby/2.4.0
RUBY EXECUTABLE: /usr/bin/ruby
EXECUTABLE DIRECTORY: /my_user/bin
SPEC CACHE DIRECTORY: /my_user/.gem/specs
SYSTEM CONFIGURATION DIRECTORY: /etc
RUBYGEMS PLATFORMS:
ruby
x86_64-linux
GEM PATHS:
/my_user/.gem/ruby/2.4.0
/usr/share/gems
/usr/local/share/gems
GEM CONFIGURATION:
:update_sources => true
:verbose => true
:backtrace => false
:bulk_threshold => 1000
REMOTE SOURCES:
https://rubygems.org/
SHELL PATH:
/my_user/anaconda2/bin
/my_user/anaconda2/bin
/usr/libexec/python2-sphinx
/usr/lib64/qt-3.3/bin
/my_user/perl5/bin
/usr/local/bin
/usr/bin
/bin
/usr/local/sbin
/usr/sbin
/usr/libexec/sdcc
/my_user/.local/bin
/my_user/bin
/usr/libexec/sdcc
Solution
There have been a few other posts regarding problems with older versions of Fedora and jekyll, here's one: https://ask.fedoraproject.org/en/question/91815/problem-installing-jekyll-in-fedora-24/
Perhaps try:
sudo dnf install ruby-devel
gem install jekyll
or as per https://linuxsuperuser.com/install-jekyll-on-fedora-23/
sudo dnf install ruby-devel
sudo dnf install redhat-rpm-config
sudo gem install jekyll
Answered By - lacostenycoder Answer Checked By - Mary Flores (WPSolving Volunteer)