Building RPMs for Ruby 1.9: How to resolve dependency issues?

platforms asked:

I’m trying to build RPMs of ruby1.9.3, for use on CentOS 6.4 and Amazon Linux x86_64 systems. Currently I have a chef recipe that downloads and installs ruby from source, replacing the system ruby if it exists. I am trying to replace that compilation process with an RPM package install instead, to speed up provisioning.

I have tried following a couple of different sets of instructions, using spec files from two different sources. I get the same results each time. I’m building using vagrant/virtualbox running 64 bit CentOS 6.4.

rpm-build seems to succeed, but then this fails:

[vagrant@localhost ~]$ rpm -Uvh rpmbuild/RPMS/x86_64/ruby-1.9.3p448-1.el6.x86_64.rpm
error: Failed dependencies:
    libruby.so.1.8()(64bit) is needed by (installed) rubygem-json-1.4.6-1.el6.x86_64
    libruby.so.1.8()(64bit) is needed by (installed) ruby-shadow-1.4.1-13.el6.x86_64
    libruby.so.1.8()(64bit) is needed by (installed) ruby-augeas-0.4.1-1.el6.x86_64
    ruby(abi) = 1.8 is needed by (installed) rubygem-json-1.4.6-1.el6.x86_64
    ruby(abi) = 1.8 is needed by (installed) ruby-shadow-1.4.1-13.el6.x86_64
    ruby(abi) = 1.8 is needed by (installed) ruby-augeas-0.4.1-1.el6.x86_64

But these dependencies are actually installed on my system:

Installed Packages
Name        : ruby-libs
Arch        : x86_64
Version     : 1.8.7.352
Release     : 12.el6_4
Size        : 5.6 M
Repo        : installed
From repo   : updates
Summary     : Libraries necessary to run Ruby
URL         : http://www.ruby-lang.org/
License     : (Ruby or GPLv2) and (GPL+ or Artistic)
Description : This package includes the libruby, necessary to run Ruby.

When I attempt to install the built rpm, I get several sets of output looking like this:

---> Package ruby-libs.i686 0:1.8.7.352-10.el6_4 will be installed
--> Processing Dependency: ruby(abi) = 1.8 for package: ruby-augeas-0.4.1-1.el6.x86_64
--> Processing Dependency: ruby(abi) = 1.8 for package: rubygem-json-1.4.6-1.el6.x86_64
--> Processing Dependency: ruby(abi) = 1.8 for package: ruby-shadow-1.4.1-13.el6.x86_64
---> Package ruby-libs.x86_64 0:1.8.7.352-12.el6_4 will be obsoleted
--> Processing Dependency: libruby.so.1.8()(64bit) for package: rubygem-json-1.4.6-1.el6.x86_64
--> Processing Dependency: libruby.so.1.8()(64bit) for package: ruby-augeas-0.4.1-1.el6.x86_64
--> Processing Dependency: libruby.so.1.8()(64bit) for package: ruby-shadow-1.4.1-13.el6.x86_64

There seems to be a dependency on an i686 version of libruby, even though both my build machine and the target builds are x86_64.

When I go into the BUILD directory and look at the config.log I find that these two flags are set: --with-arch_32=i686 --build=x86_64-redhat-linux.

Any idea what’s going on?


I answered:

The listed packages are built against, and depend on, the old version of ruby (1.8.7) which you are replacing with 1.9.3, which is not 100% binary compatible.

Thus, these packages need to be rebuilt as well.

To do this, you will need to use mock (it’s in EPEL) to build the packages, and createrepo to create your own repository, first with ruby itself, and then adding each of the other packages and gems you wish to package to your repo. Remember to edit the config in /etc/mock to point to your private repo.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.