pages-gem: Failed to build gem native extension

Hello, all

I met a snag as the following:

root@ubuntu:/home/eduOSS# gem install github-pages
Building native extensions.  This could take a while...
ERROR:  Error installing github-pages:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 -r ./siteconf20150418-11838-636jct.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.1.0/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/fast-stemmer-1.0.2/gem_make.out

The version of Ruby installed is ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux-gnu]

Could anyone please tell me why and how to tackle it? Thanks very much.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 22 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Do you mean installing ruby-dev? But the error remains the same after that step…

apt-get install ruby-dev

I had the same above issue but it turned out I did need to install the ruby headers

sudo apt-get install ruby-all-dev

Link to solutions for other distros: StackOverflow Answer

Mine also needed zlib, so:

sudo apt-get install zlib1g-dev

I don’t know why I’m being pinged here, but switch to Linux on Windows, it’s better.

On a Mac, make sure that you have the commandline tools installed

if using ruby version 2.2 or greater you need to have ruby2.2-dev

sudo apt-get install ruby2.2-dev

Did you also install the development headers? They don’t seem to be present:

mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h