Why don't gem and bundle use the same libxml2?

I seem to be in a recursive disorder loop. I try to "bind the installation" of the project, but this leads to:

An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.

So I try:

$ gem install nokogiri -v '1.6.6.2'
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.6.6.2
Parsing documentation for nokogiri-1.6.6.2
Done installing documentation for nokogiri after 2 seconds
1 gem installed

All is well! Except that when I run "bundle install", they tell me again that I need to install "gem install nokogiri -v" 1.6.6.2 "first. Ahhhhh.

The mkmf.log file suggests that this is a problem with libxml2 (unexpected surprise).

conftest.c:3:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
         ^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libxml/xmlversion.h>
4: 
5: #if LIBXML_VERSION < 20621
6: #error libxml2 is way too old
7: #endif
/* end */

So, a search for libxml2 (with "sudo find / -name libxml2") shows these directories, all of which look at least 2.9.0 or higher:

  • / usr / include / libxml2
  • / usr / local / Cellar / libxml2
  • / Usr / local / opt / libxml2

, , libxml2 ? , , , nokogiri , , , "gem install"? , , " ", .

+4
1

Mac OS X , .

brew unlink gcc-4.2      # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
+2

Source: https://habr.com/ru/post/1606491/


All Articles