Ruby xapian已完全安装在mac os x snow leopard上,但由于dlopen LoadError而失败

Ruby xapian已完全安装在mac os x snow leopard上,但由于dlopen LoadError而失败,ruby,macos,rubygems,osx-snow-leopard,xapian,Ruby,Macos,Rubygems,Osx Snow Leopard,Xapian,因为我尝试安装xapian但失败了,所以我尝试使用xapian full的另一种选择。安装似乎进行得很顺利,但当我试图用它来编写代码时,我再次被错误消息烤得焦头烂额: irb(main):001:0> require 'xapian' LoadError: dlopen(/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/xapian-full-1.1.3.4/lib/_xapian.bundle, 9): Library not loaded: /us

因为我尝试安装xapian但失败了,所以我尝试使用xapian full的另一种选择。安装似乎进行得很顺利,但当我试图用它来编写代码时,我再次被错误消息烤得焦头烂额:

irb(main):001:0> require 'xapian'
LoadError: dlopen(/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/xapian-full-1.1.3.4/lib/_xapian.bundle, 9): Library not loaded: /usr/local/lib/libxapian-1.1.3.dylib
  Referenced from: /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/xapian-full-1.1.3.4/lib/_xapian.bundle
  Reason: image not found - /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/xapian-full-1.1.3.4/lib/_xapian.bundle
    from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/xapian-full-1.1.3.4/lib/_xapian.bundle
    from /opt/ruby-enterprise/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /opt/ruby-enterprise/lib/ruby/site_ruby/1.8/xapian.rb:40
    from /opt/ruby-enterprise/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /opt/ruby-enterprise/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from (irb):1

有人知道如何解决这个问题吗?

到目前为止,在OSX上安装xapian最简单的方法是

sudo brew install xapian --python --ruby #etc

也许这对你来说就像对我一样好。特别是签出自制软件。

我已经用了很辛苦的方法完成了这项工作,我发现web上的说明似乎非常特定于操作系统和Xapian版本(因此,当您可以的时候,使用brew的动机就是如此)

但是,如果您正在寻找如何自己设置它,下面是我的最新说明,就在今天早上,在全新安装的OS X 10.6.4(雪豹)上,使用Xapian v1.2.3(撰写本文时最新的稳定版本)成功地构建了它

确保首先安装了XCode。它包括您需要的编译器工具

参考资料: http://locomotivation.squeejee.com/post/109279130/simple-ruby-on-rails-full-text-search-using-xapian

[DOWNLOAD and EXPAND]
Download the CORE and BINDINGS files from the address below. File names should be similar to the following, while the version number may vary:
  xapian-core-1.2.3.tar.gz and
  xapian-bindings-1.2.3.tar.gz
From:
  http://xapian.org/download

Open up a terminal window and cd into the directory where you saved the .tar files
Run these commands to expand the .tar files  
  tar zxvf xapian-core-<version>.tar.gz
  tar zxvf xapian-bindings-<version>.tar.gz

[BUILD and INSTALL]  
  cd xapian-core-<version>
  ./configure --prefix=/opt
  make
  !!! the "make" command MUST exit with zero errors, or you'll need to try again !!!
  sudo make install

  cd xapian-bindings-<version>
  ./configure XAPIAN_CONFIG=/opt/bin/xapian-config
  make
  sudo make install
[下载并展开]
从下面的地址下载核心和绑定文件。文件名应类似于以下内容,但版本号可能有所不同:
xapian-core-1.2.3.tar.gz和
xapian-bindings-1.2.3.tar.gz
发件人:
http://xapian.org/download
打开一个终端窗口,将cd放入保存.tar文件的目录中
运行这些命令以展开.tar文件
tar zxvf xapian芯-.tar.gz
tar-zxvf-xapian绑定-.tar.gz
[构建和安装]
cd-xapian核-
./configure--prefix=/opt
制作
!!! “make”命令必须以零错误退出,否则您需要重试!!!
sudo制作安装
cd-xapian绑定-
./configure XAPIAN_CONFIG=/opt/bin/XAPIAN CONFIG
制作
sudo制作安装

这个问题涉及Ruby gem,而不是库本身

我在尝试安装XapianFu时遇到了同样的问题,并通过执行以下操作解决了它

cp/Library/Ruby/Gems/1.8/Gems/xapian-full-1.1.3.4/xapian-core-1.1.3/.libs/*/usr/local/lib

(用安装路径替换RubyGems路径)。

此问题已在中修复。从那里下载更新的Rakefile,并将其放入

~/.gem/gems/xapian-full-1.1.3.4
通过键入来重建gem

rake
这个问题应该得到解决

更新:rex1fernando建议在以下方面采用更好的程序:


我认为这与不太标准的macports安装有关。由于某些原因,路径选项没有正确连接,因为macports试图将xapian ruby绑定安装在预期ruby库位置之外的其他位置。
git clone git://github.com/rex1fernando/xapian-full.git
cd xapian-full
(sudo) gem uninstall xapian-full
gem build xapian-full.gemspec
(sudo) gem install --local xapian-full