1

On RedHat 7 (ec2 image provided by AWS), I'm unable to install the json gem:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb 

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

I've tried all manner of packages libyaml-devel etc and nothing seems to work.

I've already run through: Error while installing json gem 'mkmf.rb can't find header files for ruby'

Community
  • 1
  • 1
Jacques Betancourt
  • 2,652
  • 3
  • 18
  • 19

3 Answers3

1

sudo rpm -Uvh ftp://195.220.108.108/linux/centos/7.0.1406/os/x86_64/Packages/ruby-devel-2.0.0.353-20.el7.x86_64.rpm

This seemed to fix it since sudo yum ruby-devel doesn't work.

Jacques Betancourt
  • 2,652
  • 3
  • 18
  • 19
1

rhel tucks things like this away in the 'optional' repo... you can enable this for aws/ec2 supplied images in:

/etc/yum.repos.d/redhat-rhui.repo

[rhui-REGION-rhel-server-optional]
name=Red Hat Enterprise Linux Server 7 Optional (RPMs)
mirrorlist=https://rhui2-cds01.REGION.aws.ce.redhat.com/pulp/mirror/content/dist/rhel/rhui/server/7/$relea$
**enabled=1**
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify=1
sslclientkey=/etc/pki/rhui/content-rhel7.key
sslclientcert=/etc/pki/rhui/product/content-rhel7.crt
sslcacert=/etc/pki/rhui/cdn.redhat.com-chain.crt

Or just do a one-time install:

yum install ruby-devel --enablerepo=rhui-REGION-rhel-server-optional

0

And if you are using subscription-manager:
subscription-manager repos --enable=rhel-7-server-optional-rpms

Then: sudo yum install -y ruby-devel

user5219763
  • 1,284
  • 12
  • 19
slong
  • 1