pecl 升级 sphinx 到新版

转载请注明出处:[Michael`s blog]

用pecl upgrade sphinx 命令 可以方便的完成php中sphinx模块的升级,但是这并不表示能够sphinx模块会自动增加官方描述里面的那些新特性,比如1.0.1版本里面增加了 setSelect()方法,1.0.3增加了open(), close()等方法,这些方法并不是通过 pecl upgrade就能得到的,原因是sphinx模块编译的时候需要调用的库 libsphinxclient 还需要升级更新,它们默认存在于 /usr/local/lib目录下,包括, libsphinxclient.a 等文件,如何升级这些库呢?


client version is higher than daemon version (client is v.1.23, daemon is v.1.22)

升级的方法是用sphinx的源代码来完成编译升级,进入到sphinx源代码目录下的 api/libsphinxclient 目录,然后执行下面的命令

#sh ./ (通常这个是必须的,因为不同的操作系统环境)
#make install

顺利的话,这就ok了,然后您就可以pecl upgrade sphinx 后完成全部升级了。 如果运气不好,在上面make的过程中,可能出现若干错误,遇到不同的错误,仔细看错误提示,大部分都是可以自己解决的,比如,我遇到了如下的错误:

cc -g -O2 -o test test.o  .libs/libsphinxclient.a
.libs/libsphinxclient.a(sphinxclient.o)(.text+0x503): In function `set_error’:
/root/packages/sphinx-1.10-beta/api/libsphinxclient/sphinxclient.c:359: undefined reference to `_vsnprintf’
*** Error code 1
cc -g -O2 -o test test.o  .libs/libsphinxclient.a.libs/libsphinxclient.a(sphinxclient.o)(.text+0x503): In function `set_error’:/root/packages/sphinx-1.10-beta/api/libsphinxclient/sphinxclient.c:359: undefined reference to `_vsnprintf’*** Error code 1

这个问题解决起来很简单,只需要vi libsphinxclient.c 文件,把里面的 #define vsnprintf _vsnprintf 注释掉或者删掉就可以了,其他的问题,可以慢慢的针对具体问题具体处理。

好了,问题就说到这里了,sphinx是个不错的东东,中文方面,需要下载和安装中文分词的模块来实现,祝您使用愉快! :)

0 thoughts on “pecl 升级 sphinx 到新版”

  1. Pingback: huawei braindumps
  2. pecl 升级 sphinx 到新版 | 李俊麟的平凡生活
    Excellent items from you, man. I’ve understand your stuff prior
    to and you are just too magnificent. I actually like what you have received right here, really like what you’re stating
    and the best way through which you say it. You make it
    enjoyable and you continue to care for to stay it
    sensible. I can not wait to learn much more from you. That is actually a terrific site.

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image