libxml-ruby 在 x86_64 上加载失败

发布于 2024-09-03 13:25:48 字数 1767 浏览 8 评论 0原文

我们在服务器端遇到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

请远离我 2024-09-10 13:25:49

尝试将 libxml-ruby gem 版本恢复到 1.1.3

try reverting your libxml-ruby gem version to 1.1.3

呆头 2024-09-10 13:25:49

由于某些原因,在 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

小兔几 2024-09-10 13:25:49

今天我们遇到了同样的问题,结果发现 ruby​​gems 安装了 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?

无畏 2024-09-10 13:25:48

我在 Centos 中遇到了完全相同的问题......显然 gem 版本 1.1.4 和 64 位机器存在问题。前往 rubyfourge 并下载版本 1.1.3。

http://rubyforge.org/frs/?group_id=494

下载 .gem,然后只需运行:

gem install libxml-ruby-1.1.3.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:

gem install libxml-ruby-1.1.3.gem

On the console. I hope this helps

阳光①夏 2024-09-10 13:25:48

无论如何,我在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文