“不兼容的库版本"在 nokogiri [英] "Incompatible library version" on nokogiri

查看:52
本文介绍了“不兼容的库版本"在 nokogiri的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经升级(apt-upgrade)我的 Ubuntu 14.03 服务器,包括 gitlab-ce.现在我的 Ruby(机架)网站似乎不再工作了.我收到以下错误:

I've upgraded (apt-upgrade) my Ubuntu 14.03 server, including gitlab-ce. Now my Ruby (rack) websites don't seem to work anymore. I get the following error:

incompatible library version - /home/taco/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.6.2/lib/nokogiri/nokogiri.so (LoadError)
/home/taco/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.6.2/lib/nokogiri.rb:29:in `require'
/home/taco/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.6.2/lib/nokogiri.rb:29:in `rescue in <top (required)>'
/home/taco/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.6.2/lib/nokogiri.rb:25:in `<top (required)>'
/home/taco/.rvm/gems/ruby-2.1.2/gems/nokogumbo-1.4.1/lib/nokogumbo.rb:1:in `require'
/home/taco/.rvm/gems/ruby-2.1.2/gems/nokogumbo-1.4.1/lib/nokogumbo.rb:1:in `<top (required)>'
/home/taco/.rvm/gems/ruby-2.1.2/gems/sanitize-4.0.0/lib/sanitize.rb:3:in `require'
/home/taco/.rvm/gems/ruby-2.1.2/gems/sanitize-4.0.0/lib/sanitize.rb:3:in `<top (required)>'
...

我使用 Nginx 运行乘客,它通常可以正常工作并且仍然可以.Geminthebox 仍然有效.我认为这与 Nginx 或乘客无关,而是只是"一些无法相处的宝石.有没有人有过此类错误的经验?

I run Passenger with Nginx, which normally works fine and still does. Geminthebox still works. I assume this is not Nginx or Passenger related, but 'just' some gems that can't get along. Does anyone have experience in these kind of errors?

更新

我客户网站的功能暂时不需要清理,所以我禁用了这部分,让客户网站重新工作.

The function of my clients websites don't really need the sanitize at this moment, so I disabled that part, to make the clients websites work again.

在那个过程中,我注意到它对 zipruby gem 也说了同样的话.而且我还注意到更多产生此错误的 gem.因此,它不是 gems 本身,而是一个底层库.我在产生此错误的 gem 上做了一些 ldd,即 nokogiri 上的 ldd

In that process I noticed it was saying the same about the zipruby gem. And I also notice more gems which generate this error. So therefor it's not the gems itself, but an underlaying library. I did some ldd's on the gems that generate this error, i.e. the ldd on nokogiri

ldd /home/taco/.rvm/gems/ruby-2.1.5/gems/nokogiri-1.6.6.2/lib/nokogiri/nokogiri.so
linux-vdso.so.1 =>  (0x00007fff5b1fd000)
libruby.so.2.1 => /home/taco/.rvm/rubies/ruby-2.1.5/lib/libruby.so.2.1 (0x00007fc4e9ae4000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc4e97de000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fc4e95c5000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc4e93a7000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc4e8fe2000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc4e8dde000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fc4e8ba5000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc4ea3f5000)

我还尝试了 nokogumbo、zipruby、rest-client 和其他几个.我还没有找到奇怪的东西.

I also tried nokogumbo, zipruby, rest-client, and several others. I couldn't find a somethings strange, yet.

顺便说一句:你可能已经注意到了,我尝试了几件事情,比如通过 rvm 使用不同的 ruby​​ 版本等,所以在上面的例子中 ruby​​ 版本是不同的.

BTW: as you might noticed, I tried several things, like using different ruby version via rvm, etc., so there's a difference in ruby versions in the examples above.

推荐答案

查看我在我的系统 (Mac OS X) 上安装的 Nokogiri,我看到 Nokogiri 的 c 扩展部分使用了以下库:

Looking at my installation of Nokogiri on my system (Mac OS X) I see that the c-extension part of Nokogiri uses the following libraries:

/Users/me/.rvm/rubies/ruby-1.9.3-p550/lib/libruby.1.9.1.dylib (compatibility version 1.9.1, current version 1.9.1)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
/usr/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.26.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 53.1.0)
/usr/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.15.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin14.0.0/4.8.3/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

其中,我非常确定 Nokogiri 在其他平台上使用 libxml2、libxslt、libz、libicucore 和 libexslt.我假设通过升级您的 Ubuntu 版本,它升级了一些系统库,这些库与您的 Nokogiri 安装所针对的库不同.

Out of these I'm pretty sure that Nokogiri uses libxml2, libxslt, libz, libicucore, and libexslt on other platforms. I'm assuming that by upgrading your version of Ubuntu it upgraded some system libraries that are different than the libraries that your install of Nokogiri is compiled against.

我要做的是找到您的 Nokogiri gem 安装生成的包含您所有 c 代码的库,并在其上运行 ldd.您的系统应该告诉您它是否正在找到它试图链接的库.我的猜测是你至少会丢失一个.

What I'd do is find the library that your Nokogiri gem installation generated that contains all your c code and run ldd on it. Your system should tell you whether or not it's finding the libraries that it's attempting to link. My guess is that you'll have at least one missing.

简单的解决方案是重新安装 Nokogiri,以便它针对您的新库版本进行编译.

Simple solution would be to re-install Nokogiri so that it compiles against your new library versions.

这篇关于“不兼容的库版本"在 nokogiri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆