为什么不是“宝石”?和“捆绑”使用相同的libxml2? [英] Why aren't "gem" and "bundle" using the same libxml2?

查看:70
本文介绍了为什么不是“宝石”?和“捆绑”使用相同的libxml2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎处于沮丧的递归循环中。我试图捆绑安装一个项目,但结果如下:

I seem to be in a recursive loop of frustration. I'm trying to "bundle install" a project, but it results in:

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.

所以我尝试:

$ 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

都很好!除了运行捆绑安装时,再次提示我需要先安装 gem install nokogiri -v‘1.6.6.2’。

All good! Except that when I run "bundle install", I am again told I need to get "gem install nokogiri -v '1.6.6.2'" to install first. AHHHHH.

mkmf.log文件表明这是libxml2的问题(令人惊讶)。

The mkmf.log file suggests this is an issue with libxml2 (surprise 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 */

因此,搜索libxml2(带有 sudo find / -name libxml2)将显示以下目录,所有目录似乎至少为2.9.0或更高:

So, searching for libxml2 (with "sudo find / -name libxml2") reveals these directories, all of which appear to be at least 2.9.0 or higher:


  • / usr / include / libxml2

  • / usr / local / Cellar / libxml2

  • / usr / local / opt / libxml2

那么,难道找不到libxml2吗?如果是这样,我如何安装捆绑软件以了解nokogiri已经安装,或者至少能够以与 gem install相同的方式进行安装?虽然我想找到一个解决方案,但我真的很想了解幕后的内容,以便将来进行故障排除。

So, is the issue that libxml2 can't be found? And if so, how do I get bundle install to realize that nokogiri is already installed, or at least be able to install it the same way "gem install" does? While I'd like to find a solution for this, I'm really interested in learning what is going on "under the covers" so I can troubleshoot in the future.

推荐答案

在Mac OS X上,我运行了以下命令,问题已得到解决。

On my Mac OS X, I ran these commands, and the problem is fixed.

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

这篇关于为什么不是“宝石”?和“捆绑”使用相同的libxml2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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