5

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?

Bogdan Gusiev
  • 8,027
  • 16
  • 61
  • 81

5 Answers5

7

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

jalagrange
  • 2,291
  • 2
  • 19
  • 24
  • Although version 1.1.4 was working fine on my local 64 bit Mac OS X, I had the same problem when deploying to a 64bit Ubuntu Linux. Downgrading to 1.1.3 solved this issue for me. Thanks! – caike Nov 17 '10 at 04:39
6

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.

Cloom Magoo
  • 486
  • 4
  • 7
3

try reverting your libxml-ruby gem version to 1.1.3

Fred
  • 286
  • 2
  • 11
1

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

Watts
  • 461
  • 1
  • 7
  • 12
0

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?

Aidan Feldman
  • 5,205
  • 36
  • 46