且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“不兼容的库版本"在 nokogiri

更新时间:2023-09-17 21:39:52

查看我在我的系统 (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.