本文介绍了Nokogiri安装失败-libxml2丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直按照中的文档来解决Nokogiri安装问题。 tutorial。



但是这一次,即使安装了所有依赖关系之后,Nokogiri还没有安装。我收到以下错误:

 缺少libxml2。请访问< http://nokogiri.org/tutorials/installing_nokogiri.html> 

我试着通过指定libxml2和libxslt目录来安装它:

  sudo gem install nokogiri  -  --with-xml2-include = / usr / include / libxml2 --with-xml2-lib = / usr / lib --with -xslt-dir = / usr / 

但它返回相同的错误。



我遵循了所有其他相关的Stack Overflow文章,没有任何帮助。有没有人有解决方案?

解决方案

首先,安装依赖关系:

  sudo apt-get install libxslt-dev libxml2-dev 

如果你仍然收到错误,你可能会缺少一个编译器工具链:

  sudo apt-get install build-essential 

如果缺少构建工具链,您将会看到libxml2 is missing在Debian Lenny上遇到这个问题)。

Nokogiri构建测试 - 编译一个libxml2头文件以验证它是否存在,但是它不区分 libxml2丢失和编译器测试libxml2丢失。


I always worked my way around Nokogiri installation issues by following the documentation in the "Installing Nokogiri" tutorial.

But this time, even after installing all the dependencies, Nokogiri hasn't been installed. I get the following error:

libxml2 is missing.  please visit <http://nokogiri.org/tutorials/installing_nokogiri.html>

I tried installing it by specifying the libxml2 and libxslt directories:

sudo gem install nokogiri -- --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib --with-xslt-dir=/usr/

but it returned the same error.

I followed all the other related Stack Overflow articles and none helped. Does anyone have a solution?

解决方案

First, install the dependencies:

sudo apt-get install libxslt-dev libxml2-dev

If you still receive the error, you may be missing a compiler toolchain:

sudo apt-get install build-essential

You'll get the "libxml2 is missing" error if you're missing a build toolchain (at least I ran into this issue on Debian Lenny).

The Nokogiri build test-compiles a libxml2 header file to verify that it is present, however, it doesn't differentiate between "libxml2 is missing" and "a compiler to test libxml2 is missing".

这篇关于Nokogiri安装失败-libxml2丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 06:40