我正在设置一台新机器(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
我在这里阅读是为了运行以下内容:
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
从我的配置/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
sphinx索引引擎由几个二进制文件组成,例如,对于索引,它使用一个名为"indexer"的可执行文件。按照错误消息中的建议,尝试将config/sphinx.yml中的值设置为安装sphinx的路径。
加载可执行文件时抛出错误。由于某些原因,动态加载程序找不到MySQL库。我在最近的MySQL版本中多次看到这种情况。
您可以在二进制文件中更改MySQL库的搜索路径,以便加载程序从如下特定位置加载它们:
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/bin/indexer
您需要对所有其他Sphinx二进制文件(如searchd)执行同样的操作。
如果在安装mysql之前安装了sphinx引擎,则有时会出现这些问题。
在这种情况下,您需要卸载sphinx,并在macosx中使用以下命令进行安装。
brew install sphinx --with-mysql
一旦你做到了,参考问题就会得到解决。