简体   繁体   中英

libxml-ruby failed to load at x86_64

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?

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

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.

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

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, ie:

gem install libxml-ruby --platform ruby

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM