“在你的系统上找不到狮身人面像。”当运行“rake ts:index”时

时间:2011-05-31 16:11:11

标签: mysql ruby-on-rails thinking-sphinx

我正在设置一台新机器(OS X 10.6.7)来运行使用ThinkingSphinx的Rails应用程序。我已按照安装说明进行操作,但我仍然会收到以下信息:

$ rake ts:index
(in /Users/robert/Projects/Office/code/office)
sh: line 1:  7050 Trace/BPT trap          indexer 2>&1
sh: line 1:  7053 Trace/BPT trap          indexer 2>&1

Sphinx cannot be found on your system. You may need to configure the following settings in your config/sphinx.yml file:
  * bin_path
  * searchd_binary_name
  * indexer_binary_name

For more information, read the documentation:
http://freelancing-god.github.com/ts/en/advanced_config.html
sh: line 1:  7055 Trace/BPT trap          indexer 2>&1
Generating Configuration to /Users/robert/Projects/Office/code/office/config/development.sphinx.conf
dyld: Library not loaded: libmysqlclient.18.dylib
  Referenced from: /usr/local/bin/indexer
  Reason: image not found

我看了here来运行以下内容:

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql

但我仍然遇到同样的错误。不确定这是否有帮助,但更多信息:

$ cd /usr/local/mysql/lib
$ ls
lib                        libmysqlclient_r.dylib
libmysqlclient.18.dylib    libmysqld-debug.a
libmysqlclient.a           libmysqld.a
libmysqlclient.dylib       libmysqlservices.a
libmysqlclient_r.18.dylib  mysql
libmysqlclient_r.a         plugin

从我的config / sphinx.yml:

development:
  port: 9312
  enable_star: true
  min_prefix_len: 2
  html_strip: true
  bin_path: /usr/local/bin
production:
  port: 9312
  enable_star: true
  min_prefix_len: 2
  html_strip: true
  bin_path: /usr/local/bin

3 个答案:

答案 0 :(得分:2)

sphinx索引引擎由几个二进制文件组成,例如用于索引,它使用一个名为“indexer”的可执行文件。尝试将config / sphinx.yml中的值设置为安装sphinx的路径,如错误消息中所示。

答案 1 :(得分:2)

加载可执行文件时抛出错误。由于某种原因,动态加载程序无法找到MySQL库。我已经看到这种情况在最近的MySQL版本中发生了很多次。

您可以在二进制文件中更改MySQL库的搜索路径,以便加载程序将从特定位置加载它们,如下所示:

sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/bin/indexer

您需要对所有其他Sphinx二进制文件(如searchd)执行相同的操作。

答案 2 :(得分:0)

如果您在安装mysql之前安装了sphinx引擎,有时会出现这些问题。

在这种情况下,您需要卸载sphinx并使用macosx中的以下命令进行安装。

brew install sphinx --with-mysql

完成后,参考问题将得到解决。