Jekyll quick start: Error installing jekyll, failed to build gem native extension

I’m looking at starting another blog at impractical.bot, as a home for my impractical chatbots. I thought I should check out a blog software other than WordPress, since all of my infosec colleagues make fun of me for using it. One option on my list is Jekyll, which builds static sites. That’s great if you are worried about resources (i.e. super-cheap hosting) and security.

The Jekyll site includes a 4-step quickstart. Unfortunately, it failed for me at step #1:

Error installing jekyll, failed to build gem native extension

I’m running this on a Fedora 27 virtual machine that I spun up for testing Jekyll:

$ cat /etc/system-release
Fedora release 27 (Twenty Seven)

My Ruby version is up-to-date:

$ ruby --version
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]

Gem is installed and up-to-date:

$ gem --version
2.6.14.1

I took a closer look at the details of the error message:

gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: no such file or directory

I’m probably just missing a package, let’s see what package provides that file:

$ dnf provides redhat-hardened-cc1
Error: No Matches found

Fine, I let Google point me to a relevant StackOverflow post: G++ error:/usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory

$ sudo dnf install redhat-rpm-config

I tried again:

$ sudo gem install bundler jekyll

It still failed, but with a different error:

make: g++: Command not found

I installed gcc-c++:

$ sudo dnf install gcc-c++

I tried to install Jekyll yet again:

$ sudo gem install bundler jekyll

That worked!

The following steps in Jekyll’s quickstart worked too:

$ jekyll new my-awesome-site
$ cd my-awesome-site
$ bundle exec jekyll serve

I copied my ~/my-awesome-site/_site folder to my document root (this can be automated with Jekyll, but I’m not there yet), and now, voila! my site is live:
http://impractical.bot

3 thoughts on “Jekyll quick start: Error installing jekyll, failed to build gem native extension”

  1. I also tried the Jekyll quickstart on a CentOS host but ran into problems even earlier:

    $ sudo yum install ruby gem
    $ gem install bundler jekyll
    ...
    ERROR:  Error installing jekyll:
            public_suffix requires Ruby version >= 2.1.

    Apparently the version of Ruby on CentOS 7.5 is a little out-of-date:

    $ ruby --version
    ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

    I’m sure all of this works perfectly for Ubuntu users.

  2. I installed gcc+c++:

    $ sudo dnf install gcc+c++

    The correct command is sudo dnf install gcc-c++

    I guess there you mistyped it. Usually we will copy paste code and script right? How does this occur? Just curious.

  3. @Pradeep, thanks for alerting me to the error. I’ve corrected the post.

    I had not installed the VirtualBox Guest Additions, without which copy-and-paste from a guest VM does not work. Rather than take the extra steps, I decided to re-type the commands, unfortunately trusting myself to re-type them accurately!

    For any visitors who would like to know more about installing the VirtualBox Guest Additions:

    1. Select Devices — Insert Guest Additions CD image… on the VirtualBox menu. You should be prompted to run the installer, and to enter credentials if you are not the root user.
    2. On my system, modprobe failed to add the kernel module automatically, so I had to reboot.
    3. Select Devices — Shared Clipboard — Bidirectional on the VirtualBox menu

    You should now be able to copy-and-paste from your host to guest and vice-versa.

Leave a Reply

Your email address will not be published. Required fields are marked *