YY博客

分享英语网站运营的经验

By

sphinx编译安装出错:undefined reference to libiconv 解决方案

编译过程中提示出错:
错误描述

/usr/local/sphinx/src/sphinx.cpp:20060:undefined reference to libiconv_open'
/usr/local/sphinx/src/sphinx.cpp:20078: undefined reference to
libiconv’
/usr/local/sphinx/src/sphinx.cpp:20084: undefined reference to libiconv_close'
collect2: ld returned 1exit status
make[2]:***[indexer]Error1
make[2]:Leaving directory
/home/sphinx/src’
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sphinx/src’
make: *** [all-recursive] Error 1

解决办法:sphinx-2.2.11-release亲测有效:
===============以下为解决方案=======================================================

原因是g++没有添加 -libiconv选项

cd sphinx-2.1.9-release
vi src/Makefile

把LIBS = -lm -lz -lexpat -L/usr/local/lib -lrt -lpthread
改成
LIBS = -lm -lz -lexpat -L/usr/local/lib -lrt -lpthread -liconv

即可。

发表回复

您的电子邮箱地址不会被公开。