libxml-ruby 在 x86_64 上加载失败
我们在服务器端遇到 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 版本 1.1.4
重新安装 gem 不会帮不上忙 有人可以建议该怎么做吗?
We are having problem with libxml-ruby gem at the server side
Possible because it uses x86_64 architecture:
$ 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
Reinstalling the gem doesn't help
Can somebody suggest what to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试将 libxml-ruby gem 版本恢复到 1.1.3
try reverting your libxml-ruby gem version to 1.1.3
由于某些原因,在 Linux 上,有时 gem 会感到困惑并安装 libxml-ruby 的 Windows DLL。您可以通过在 (ruby lib 路径)/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml_ruby.so 上执行
file
来验证这一点,它表示 libxml_ruby.so是一个Windows PE DLL。我发现解决这个问题的方法是强制平台,即:
gem install libxml-ruby --platform ruby
For some reason on Linux, sometimes gem gets confused and installs the Windows DLL for libxml-ruby. You can verify this by doing a
file
on (ruby lib path)/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml_ruby.so and it says that libxml_ruby.so is a Windows PE DLL.The way I've found to work around this is to force the platform, i.e:
gem install libxml-ruby --platform ruby
今天我们遇到了同样的问题,结果发现 rubygems 安装了 Windows dll,而不是 ELF *.so。我们正在运行相当旧版本的 Rubygems (1.3.7),但重新安装 gem 以某种方式解决了问题。不确定该版本的 Rubygems 中是否存在平台检测或其他什么?
We ran into the same problem today, and it turned out that rubygems had installed the Windows dll instead of an ELF *.so. We are running a fairly old version of Rubygems (1.3.7), but reinstalling the gem somehow solved the problem. Not sure if platform detection in that version of Rubygems or something?
我在 Centos 中遇到了完全相同的问题......显然 gem 版本 1.1.4 和 64 位机器存在问题。前往 rubyfourge 并下载版本 1.1.3。
http://rubyforge.org/frs/?group_id=494
下载 .gem,然后只需运行:
在控制台上。我希望这有帮助
I had this exact same issue in a Centos....Aparently there is a problem with gem version 1.1.4 and 64 bit machines. Head over to rubyfourge and dowload version 1.1.3.
http://rubyforge.org/frs/?group_id=494
download the .gem an then just run:
On the console. I hope this helps
无论如何,我在 ubuntu 中遇到了同样的问题,有效的方法是安装 libxml 开发包,详细信息 此处
对于 Ubuntu,使用 apt-get 而不是 yum:
% sudo apt-get install libxml2-dev
然后 libxml-ruby gem 的安装就像一个魅力。
For what it's worth, I was having the same issue in ubuntu, and what worked was to install the libxml dev package, as detailed here
for Ubuntu, use apt-get instead of yum:
% sudo apt-get install libxml2-dev
then the install of libxml-ruby gem works like a charm.