How to control ruby-devel presence in a Software Collections environment

2.8k views Asked by At

I'm currently trying to build a Ruby app on a Centos 6.6 machine. There are different Ruby stacks installed through Software Collections. Please not that I do not have root on the machine, and my privileges are limited, particularly, they do not include package installation.

Native extensions do not build. It seems ruby-devel is missing, but I was told by the admin that it was correctly installed for both stacks:

dnf install rh-ruby22-ruby-devel.x86_64 ruby193-ruby-devel.x86_64 -y

Here is my problem:

bob@server ~> scl enable rh-ruby22 bash
bash-4.1$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux-gnu]

bash-4.1$ gem install json Building native extensions.  This could take a while... ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    /opt/rh/rh-ruby22/root/usr/bin/ruby -r ./siteconf20150625-17536-saskmd.rb extconf.rb mkmf.rb can't find header files for ruby at /opt/rh/rh-ruby22/root/usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in ~/.gem/ruby/gems/json-1.8.3 for inspection. Results logged to ~/.gem/ruby/extensions/x86_64-linux/json-1.8.3/gem_make.out

How can I check if ruby-devel (more precisely, rh-ruby22-ruby-devel.x86_64) is properly installed?

What would be the next place to search if it's working as intended?

2

There are 2 answers

0
st3v3o On

This is most likely because you don't have the devel libraries installed for the SCLo ruby version.

sudo yum install rh-ruby22-ruby-devel

0
maddop On

You will need to export your library paths to get it up and running correctly.

e.g.

export PATH=/opt/rh/rh-ruby22/root/usr/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/opt/rh/rh-ruby22/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MANPATH=/opt/rh/rh-ruby22/root/usr/share/man:$MANPATH
export PKG_CONFIG_PATH=/opt/rh/rh-ruby22/root/usr/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
# For SystemTap.
export XDG_DATA_DIRS=/opt/rh/rh-ruby22/root/usr/share${XDG_DATA_DIRS:+:${XDG_DATA_DIRS}}