解决sphinx编译出错:undefined reference to `libiconv’

编译安装sphinx出错undefined reference to `libiconv’

编译shhinx出现如下错误:

libsphinx.a(sphinx.o): In function `xmlUnknownEncoding’:
/data/src/sphinx-0.9.8-rc2/src/sphinx.cpp:17161: undefined reference to `libiconv_open’
/data/src/sphinx-0.9.8-rc2/src/sphinx.cpp:17179: undefined reference to `libiconv’
/data/src/sphinx-0.9.8-rc2/src/sphinx.cpp:17185: undefined reference to `libiconv_close’
libsphinx.a(tokenizer_zhcn.o): In function `CSphTokenizer_zh_CN_GBK::SetBuffer(unsigned char*, int)’:
/data/src/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:280: undefined reference to `libiconv’
libsphinx.a(tokenizer_zhcn.o): In function `CSphTokenizer_zh_CN_UTF8_Private::GetConverter(char const*, char const*)’:
/data/src/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:55: undefined reference to `libiconv_open’
/data/src/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:58: undefined reference to `libiconv’
libsphinx.a(tokenizer_zhcn.o): In function `~CSphTokenizer_zh_CN_UTF8_Private’:
/data/src/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:34: undefined reference to `libiconv_close’
/data/src/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:34: undefined reference to `libiconv_close’
/data/src/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:34: undefined reference to `libiconv_close’
collect2: ld 返回 1
make[2]: *** [indexer] 错误 1
make[2]: Leaving directory `/data/src/sphinx-0.9.8-rc2/src’
make[1]: *** [all] 错误 2
make[1]: Leaving directory `/data/src/sphinx-0.9.8-rc2/src’
make: *** [all-recursive] 错误 1

修改sphinx-0.9.8-rc2/src/Makefile,


LIBS = -lm -lexpat -L/usr/local/lib
改成
LIBS = -lm -lexpat -liconv -L/usr/local/lib

重新编译即可。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注


*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>