我使用通过 RVM 安装的 ruby 2.0.0 在我的工作站上运行 Ubuntu 13.04。
$ aptitude show libxml2
Package: libxml2
State: installed
Automatically instlled: no
Multi-Arch: same
Version: 2.9.0+dfsg1-4ubuntu4.1
$ aptitude show libxml2-dev
Package: libxml2-dev
State: installed
Automatically installed: no
Multi-Arch: same
Version: 2.9.0+dfsg1-4ubuntu4.1
$ aptitude show libxslt-dev
Package: libxslt1-dev
State: installed
Automatically installed: no
Version: 1.1.27-1ubuntu2
Priority: optional
$ nokogiri -v
WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.8.0
# Nokogiri (1.6.0)
---
warnings:
- Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.8.0
nokogiri: 1.6.0
ruby:
version: 2.0.0
platform: x86_64-linux
description: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
engine: ruby
libxml:
binding: extension
source: packaged
libxml2_path: /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxml2/2.8.0
libxslt_path: /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxslt/1.1.26
compiled: 2.9.0
loaded: 2.8.0
我使用命令安装了 nokogiri,因为它使用的是 libxml2 版本 2.8.0,但我不确定它从哪里获取,因为只有 libxml2 是通过 apt 安装的。
gem install nokogiri -- --with-xml2-include=/usr/include/libxml2/libxml --with-xslt-dir=/usr/include/libxslt
当我运行我的应用程序时,我收到以下错误:
/home/pb/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
require': /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxml2/2.8.0/lib/libxml2.so.2: version
LIBXML2_2.9.0' not found (required by /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/libxml-ruby-2.6.0/lib/libxml_ruby.so) - /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/libxml-ruby-2.6.0/lib/libxml_ruby.so (LoadError)
谁能告诉我如何摆脱 libxml2 2.8.0 版?
谢谢