libiconv安装 undefined reference to `libiconv_open'

发布时间:2016-03-22 17:31:33编辑:丝画阁阅读(445)

http://www.gnu.org/software/libiconv/#TOCdownloading



sphinx/coreseek安装全过程中遇到的一些问题
libsphinx.a(sphinx.o): In function `CSphTokenizer_zh_CN_GBK::GetLocalBuffer(unsigned char*, int, unsigned char*)':
/setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:4764: undefined reference to `libiconv'
libsphinx.a(sphinx.o): In function `CSphTokenizer_zh_CN_UTF8_Private::GetConverterOutput(char const*, char const*)':
/setup/coreseek-3.2.14/csft-3.2.14/src/tokenizer_zhcn.h:86: undefined reference to `libiconv_open'
/setup/coreseek-3.2.14/csft-3.2.14/src/tokenizer_zhcn.h:89: undefined reference to `libiconv'
libsphinx.a(sphinx.o): In function `CSphTokenizer_zh_CN_GBK::SetBuffer(unsigned char*, int)':
/setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:4792: undefined reference to `libiconv'
libsphinx.a(sphinx.o): In function `CSphTokenizer_zh_CN_UTF8_Private::GetConverter(char const*, char const*)':
/setup/coreseek-3.2.14/csft-3.2.14/src/tokenizer_zhcn.h:70: undefined reference to `libiconv_open'
/setup/coreseek-3.2.14/csft-3.2.14/src/tokenizer_zhcn.h:73: undefined reference to `libiconv'
libsphinx.a(sphinx.o): In function `xmlUnknownEncoding':
/setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:20719: undefined reference to `libiconv_open'
/setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:20737: undefined reference to `libiconv'
/setup/coreseek-3.2.14/csft-3.2.14/src/sphinx.cpp:20743: undefined reference to `libiconv_close'
collect2: ld 返回 1
make[2]: *** [indexer] 错误 1
make[2]: Leaving directory `/setup/coreseek-3.2.14/csft-3.2.14/src'
make[1]: *** [all] 错误 2
make[1]: Leaving directory `/setup/coreseek-3.2.14/csft-3.2.14/src'
make: *** [all-recursive] 错误 1



解决
一开始以为libiconv的问题,又重装了几次还是一样,最后终于找着办法了
编辑:
./src/MakeFile文件
LIBS = -lm -lexpat -L/usr/local/lib
改成
LIBS = -lm -lexpat -liconv -L/usr/local/lib



Linux下libiconv库的安装和使用:

The latest release is http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz


1.编译安装libiconv库

包的下载页面http://www.gnu.org/software/libiconv/
或者用libiconv命令下载命令


# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz


./configure --prefix=/usr/local     (或者#./configure --prefix=/usr/local/libiconv)

make

make install


在CentOS 编译sphinx时老出现xmlUnknownEncoding 错误
我用的configure命令是:
./configure --prefix=/usr/local/csft --with-mysql --with-mmseg=/usr/local/mmseg/bin/mmseg --with-mmseg-includes=/usr/local/mmseg/include/mmseg --with-mmseg-libs=/usr/local/mmseg/lib/  --with-iconv --enable-id64

我也安装了libiconv,在makefile也修改了LIBS = -lm -lz -lexpat -liconv -L/usr/local/lib -lpthread

我在网上找了老半天,有些人说是 libiconv的什么路径/var/local 有问题  libiconv安装里使用./configure --prefix=/usr/local/libiconv




关键字