WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.6.16

亡梦爱人 提交于 2019-11-28 06:19:55
Gareth

In the end I had to install the gem against the specific versions of xml2 and xslt I have installed:

gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.7/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.7/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
#. scrollbar line, so the code can be seen

The problem was most likely bad library management, switching between package managers without being tidy enough about it.

Fix for Nokogiri w. libxml2 2.7.8 loading libxml2 2.7.3

Wanted to add to the above answers: If you dont have libxml2 in the Cellar directory on OSX, you can install it to this using homebrew, as explained on Nokogiri's homepage (homebrew 0.8 or higher, test with brew -v):

brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri -- --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include
Sojoodi

I had a different warning:

WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.7.8

rebuilt the gem with the newer library to get rid of the warning:

gem install --no-rdoc --no-ri nokogiri -- --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib

The accepted solution didn't work for me, but this did:

gem install --no-rdoc --no-ri nokogiri -- --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib

This compiles against the MacOS system library. It's possible Macports (which I prefer to brew) is not set up properly on my machine, though.

Nokogiri was built correctly, but another gem was required first and loaded the old libxml2 library.

In your app, you should require nokogiri first, to force the app to load the dynamic libxml2 library instead of the older system version of libxml2 loaded by gems that failed to specify which library to load.

Per Stella Miranda, I followed the steps to resolve my own nokogiri issue on Mountain Lion:

  1. gem uninstall nokogiri
  2. gem install nokogiri

No more nokogiri warnings!

mavenroger

Ensure it's not just a ruby compilation issue. This just came up on OSX Mountain Lion, as the system libxml was bumped, but the ruby was compiled on the previous libxml. It can be solved by uninstalling and reinstalling ruby.

My answer on another thread for reference: https://stackoverflow.com/a/11714789/1561677

I used to have an issue like that, do you really need two version of libxml on your system? Otherwise, uninstall all the older version of libxml and just in case force the reinstallation of nokogiri.

I was having the same problem. All I did was add a line in my Gemfile to explicitly require the most recent version of nokogiri (as of 3/17/2013, 1.5.6), then I did a bundle update nokogiri, and it fixed the problem.

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