我做了各种各样的研究,尝试了很多不同的东西.我知道这个问题已被多次回答,但没有一个建议的解决方案对我有用.
升级到Lion后,我在Ruby中遇到了分段错误.我相当自信是Nokogiri.所以我通过Homebrew安装了libxml2.我跑brew link libxml2.然后我使用该版本的库重新安装了Nokogiri.
证明:
$ nokogiri -v
# Nokogiri (1.5.0)
---
warnings: []
nokogiri: 1.5.0
ruby:
version: 1.9.2
platform: x86_64-darwin11.0.0
description: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
engine: ruby
libxml:
binding: extension
compiled: 2.7.8
loaded: 2.7.8
Run Code Online (Sandbox Code Playgroud)
我已经将Nokogiri包含在我的gemfile的顶部,我也在我的环境文件中需要它.我不知道为什么我仍然会收到警告.
任何建议或想法,以确保它正在加载正确的版本libxml2?
当我启动Rails时,我无法理解为什么我从Nokogiri那里得到这个错误.从我知道的一点点来看,似乎有些东西导致加载旧版本的libxml2,Nokogiri最终会使用它,而不是它编译的版本.
如果没有警告(并使用正确的libxml2),我需要做什么才能使其正常工作?
我在OS X 10.5.8的Macbook上运行它:
$ rake db:create
(in /Users/gareth/Sites/Rails3/ngtest)
WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.6.16
HI. You're using libxml2 version 2.6.16 which is over 4 years old and has
plenty of bugs. We suggest that for maximum HTML/XML parsing pleasure, you
upgrade your version of libxml2 and re-install nokogiri. If you like using
libxml2 version 2.6.16, but don't like this warning, please define the constant
I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 before requring nokogiri.
ngtest_test already exists …Run Code Online (Sandbox Code Playgroud)