我们在服务器端遇到libxml-ruby gem的问题 可能因为它使用x86_64架构:
$ uname -a Linux ip-10-228-171-64 2.6.21.7-2.fc8xen-ec2-v1.0#1 SMP Tue Sep 1 10:25:30 EDT 2009 x86_64 GNU / Linux
require 'libxml'
LoadError: /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml_ruby.so: invalid ELF header - /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml_ruby.so
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml_ruby.so
from /usr/local/ruby-enterprise/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml.rb:9
from /usr/local/ruby-enterprise/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/ruby-enterprise/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from (irb):1
gem version 1.1.4
重新安装gem无济于事 有人可以建议做什么吗?
答案 0 :(得分:7)
我在Centos中遇到了同样的问题....显然宝石版1.1.4和64位机器存在问题。转到rubyfourge并下载1.1.3版本。
http://rubyforge.org/frs/?group_id=494
下载.gem然后运行:
gem install libxml-ruby-1.1.3.gem
在控制台上。我希望这有帮助
答案 1 :(得分:6)
对于它的价值,我在ubuntu中遇到了同样的问题,并且有效的方法是安装libxml dev软件包,详见here
对于Ubuntu,使用apt-get而不是yum: %sudo apt-get install libxml2-dev
然后安装libxml-ruby gem就像魅力一样。
答案 2 :(得分:3)
尝试将libxml-ruby gem版本恢复为1.1.3
答案 3 :(得分:1)
由于某些原因在Linux上,有时gem会混淆并为libxml-ruby安装Windows DLL。您可以通过执行file
on(ruby lib path)/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml_ruby.so来验证这一点,它说libxml_ruby.so是一个Windows PE DLL。
我发现解决这个问题的方法是强制平台,即:
gem install libxml-ruby --platform ruby
答案 4 :(得分:0)
我们今天遇到了同样的问题,结果发现rubygems安装了Windows dll而不是ELF * .so。我们正在运行一个相当旧版本的Rubygems(1.3.7),但重新安装gem以某种方式解决了这个问题。不确定该版本的Rubygems中是否有平台检测?