error in installing ruby-devel using yum?

1.8k views Asked by At

Hello I try to install ruby gem json but it gives following error

`Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension.

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

Gem files will remain installed in /home/jenkins/.gem/ruby/gems/json-2.0.2 for inspection. Results logged to /home/jenkins/.gem/ruby/gems/json-2.0.2/ext/json/ext/generator/gem_make.out`

I looked up similar post and was directed to install ruby-devel. But thats also given me a hard time.

yum install ruby-devel
Loaded plugins: addreleaserel, priorities, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package ruby-devel.x86_64 0:2.0.0.598-25.el7_1 will be installed
--> Processing Dependency: ruby(x86-64) = 2.0.0.598-25.el7_1 for package: ruby-devel-2.0.0.598-25.el7_1.x86_64
--> Finished Dependency Resolution
Error: Package: ruby-devel-2.0.0.598-25.el7_1.x86_64 (RHN-rhel-x86_64-server-optional-7-1-locked)
          Requires: ruby(x86-64) = 2.0.0.598-25.el7_1
          Installed: ruby-2.0.0.648-29.el7.x86_64 (@RHN-rhel-x86_64-server-7-latest)
              ruby(x86-64) = 2.0.0.648-29.el7
          Available: ruby-2.0.0.353-20.el7.x86_64 (RHN-rhel-x86_64-server-7)
              ruby(x86-64) = 2.0.0.353-20.el7
          Available: ruby-2.0.0.353-22.el7_0.x86_64 (RHN-rhel-x86_64-server-7)
              ruby(x86-64) = 2.0.0.353-22.el7_0
          Available: ruby-2.0.0.598-24.el7.x86_64 (RHN-rhel-x86_64-server-7)
              ruby(x86-64) = 2.0.0.598-24.el7
          Available: ruby-2.0.0.598-25.el7_1.x86_64 (RHN-rhel-x86_64-server-7-1-locked)
              ruby(x86-64) = 2.0.0.598-25.el7_1
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

Can anyone suggest me steps to install ruby-devel using yum?please

1

There are 1 answers

0
GracefulRestart On BEST ANSWER

Something seems off about your configured repositories.

From your error message, YUM is attempting to install ruby-devel.x86_64 0:2.0.0.598-25.el7_1 from the "RHN-rhel-x86_64-server-optional-7-1-locked" channel, but you currently have ruby-2.0.0.648-29.el7.x86_64 installed from the "@RHN-rhel-x86_64-server-7-latest" channel which will not satisfy the dependency as the release versions do not match.

For YUM to complete the transaction you posted, it would have to install an older version of the RedHat ruby package and I don't think it wants to do that without being explicitly told.

There are a couple options I can think of, depending on how you want to resolve this. My first suggestion is what I would do if I were managing this server, which is to straighten out the repository configuration and discover why yum install ruby-devel is attempting to install an older package (it might have something to do with that locked channel).

The other option is to install that ruby-devel package by any means necessary which may not be good for your RedHat subscription or could break things. You would first replace the installed version of ruby with the older one that matches ruby-devel, then attempt to install ruby-devel:

yum downgrade ruby-2.0.0.598-25
yum install ruby-devel-2.0.0.598-25

I do not have a RedHat machine with a subscription so I would not be able to test if this second suggestion would even work, use at your own risk. I would also recommend again you attempt the first suggestion of fixing your repositories or figure out why one of the channels is locked as that method would be safer and you could get support from RedHat if needed.

Hope that helps