libxml-ruby failed to load at x86_64

别等时光非礼了梦想. 提交于 2020-01-03 15:15:26

问题


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?


回答1:


try reverting your libxml-ruby gem version to 1.1.3




回答2:


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




回答3:


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.




回答4:


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




回答5:


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?



来源:https://stackoverflow.com/questions/2915788/libxml-ruby-failed-to-load-at-x86-64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!