1

我目前正在尝试在 Centos 6.6 机器上构建一个 Ruby 应用程序。通过软件集合安装了不同的 Ruby 堆栈。请注意我在机器上没有root,我的权限是有限的,特别是它们不包括包安装。

本机扩展不构建。它似乎ruby-devel丢失了,但管理员告诉我,它已为两个堆栈正确安装:

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

这是我的问题:

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

如何检查ruby-devel(更准确地说,rh-ruby22-ruby-devel.x86_64)是否正确安装?

如果它按预期工作,下一个要搜索的地方是什么?

4

2 回答 2

7

这很可能是因为您没有为 SCLo ruby​​ 版本安装开发库。

sudo yum install rh-ruby22-ruby-devel

于 2016-04-27T11:56:42.903 回答
0

您需要导出库路径以使其正常运行。

例如

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}}
于 2017-03-17T10:26:49.903 回答