CentOS 5.5
我重新启动时遇到这个问题mcollective
:
# service mcollective restart
Shutting down mcollective:
Starting mcollective: /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- stomp (LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/lib/ruby/site_ruby/1.8/mcollective.rb:2
from /usr/sbin/mcollectived:3:in `require'
from /usr/sbin/mcollectived:3
[FAILED]
STOMP 协议 Ruby 库已安装:
# gem list stomp
*** LOCAL GEMS ***
stomp (1.2.2, 1.1.8)
我正在运行 ruby 1.8.7,其 RubyGems 环境如下:
# ruby -v
ruby 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
# gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
作为@RIPienaar指出,我混淆了两个 Ruby 版本:一个是由其安装的,yum
另一个是从源代码编译的。
我已经卸载了所有二进制 ruby-* 包,问题应该变为:
如何让 MCollective 找出从源代码编译成的 Ruby /usr/local/bin
?:
# cd /usr/local/src/marionette-collective
# rake rpm
...
Building RPM for mcollective-2.0.0-1
================
which: no rpmbuild-md5 in (/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/bin:/opt/redis/bin)
error: Failed build dependencies:
ruby is needed by mcollective-2.0.0-1.el5.noarch
ruby(abi) = 1.8 is needed by mcollective-2.0.0-1.el5.noarch
rake aborted!
Failed: rpmbuild -D 'version 2.0.0' -D 'rpm_release 1' -D 'dist .el5' -D 'use_lsb 0' -ba /usr/src/redhat/SPECS/mcollective.spec
/usr/local/src/marionette-collective/Rakefile:35:in `safe_system'
(See full trace by running task with --trace)
或者如何从源代码编译 MCollective?
答案1
看起来你的系统上有 2 颗红宝石或一些配置错误,
mcollective 使用位于 /usr/lib/ruby/* 中的系统 ruby
Starting mcollective: /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- stomp (LoadError)
当你的 gem 安装到 /usr/local/* 时
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
答案2
您正在尝试从 .spec 文件构建 RPM 包,而这需要安装 ruby 包。由于您是从头开始编译 ruby,因此这会是个问题。
因此,您的解决方案是创建或找到 ruby 的 spec 文件,并根据该 spec 构建 ruby 二进制包。例如,这是我的版本(我从 1.9.2 中 fork 而来):
https://github.com/rilindo/ruby-1.9.3-rpm
一旦二进制包构建完成,就使用该包重新安装 ruby,删除/禁用当前手动编译的 ruby 安装,然后从 .spec 文件构建 mcollective 包。