undefined reference to `libiconv(已解决)

undefined reference to `libiconv(已解决)

2009年05月05日 星期二 14:21

安装sphinx时又报错,真是疯了啊。

在make时报错,错误内容:
r/local/src/sphinx/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:280: undefined reference to `libiconv’
libsphinx.a(tokenizer_zhcn.o)(.text+0x6fd):/usr/local/src/sphinx/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:55: undefined reference to

`libiconv_open’
libsphinx.a(tokenizer_zhcn.o)(.text+0x719):/usr/local/src/sphinx/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:58: undefined reference to

libiconv' libsphinx.a(tokenizer_zhcn.o)(.text+0x7a4): In function CSphTokenizer_zh_CN_UTF8::CSphTokenizer_zh_CN_UTF8()’:
/usr/local/src/sphinx/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:34: undefined reference to libiconv_close' libsphinx.a(tokenizer_zhcn.o)(.text+0xd04): In function CSphTokenizer_zh_CN_UTF8::
CSphTokenizer_zh_CN_UTF8()’:
/usr/local/src/sphinx/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:34: undefined reference to libiconv_close' libsphinx.a(tokenizer_zhcn.o)(.text+0x125c): In function CSphTokenizer_zh_CN_UTF8::~CSphTokenizer_zh_CN_UTF8()’:
/usr/local/src/sphinx/sphinx-0.9.8-rc2/src/tokenizer_zhcn.cpp:34: undefined reference to `libiconv_close’

解决
一开始以为libiconv的问题,又重装了几次还是一样,最后终于找着办法了
编辑:
./src/MakeFile文件

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

ok了

还是不行啊

gcc -O2 -fno-strict-aliasing -pipe -L /usr/obj/usr/src/sys/GOD/modules/usr/src/sys/modules/libiconv/ -liconv ~/test/iconv/main.c -o ~/test/iconv/code
/home/soj/test/iconv/main.c: In function main': /home/soj/test/iconv/main.c:49: warning: passing arg 2 of libiconv’ from incompatible pointer type
/usr/bin/ld: cannot find -liconv

dangk 发表于 2006-12-19 15:50

回复 3楼 balabalacha 的帖子

-I/usr/local/include -L/usr/local/lib/ -liconv

balabalacha 发表于 2006-12-19 20:42