“Incompatible library version” on nokogiri

拟墨画扇 提交于 2020-01-07 09:04:55

问题


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)>'
...

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?

Update

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.

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)

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

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.


回答1:


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)

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.

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.

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



来源:https://stackoverflow.com/questions/32832899/incompatible-library-version-on-nokogiri

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