作者 : Bun Wong
日期 : 2010年08月07日
标签 : Mac Sphinx
浏览 : 910 次
评论 : 0 个
http://www.hdwong.com/article/compile-sphinx-error-on-mac-os-x.html

Mac OS X 编译 sphinx 的一问题解决办法

其它分享 @ 2010年08月07日 收藏&分享

昨天研究了一下 sphinx,回家在 Mac OS X 下用同样的方式编译 sphinx 时发生错误,

svn export http://sphinxsearch.googlecode.com/svn/trunk sphinx
cd sphinx
./configure --prefix=/usr/local/sphinx --with-mysql
make
...
sphinxstd.cpp: In function ‘bool sphIsLtLib()’:
sphinxstd.cpp:1001: error: ‘_CS_GNU_LIBPTHREAD_VERSION’ was not declared in this scope
make[2]: *** [sphinxstd.o] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

最终在 sphinx 的 bug list 下找到该问题的解决办法 (bug #515)。

编辑 sphinx/src/sphinxstd.cpp,找到方法 sphIsLtLib(),修改该函数部分:

#if !USE_WINDOWS
bool sphIsLtLib()
{
#ifndef _CS_GNU_LIBPTHREAD_VERSION
    return false;
// #endif  // 删除该行, 增加下一行
#else

    char buff[64];
    confstr ( _CS_GNU_LIBPTHREAD_VERSION, buff, 64 );

    if ( !strncasecmp ( buff, "linuxthreads", 12 ) )
        return true;
    return false;
#endif  // 增加此行
}
#endif

然后重新 make 即可编译成功。

评论 (0)

还没有评论

* 昵称:

* 评论:

* 验证码: (请输入下图的 4 位数字)

Captcha看不请, 换一张

© 2011 Bun Wong

本博客基于 Bun PHP Framework 构建 • 粤ICP备07036370号