Ubuntu下安装libiconv-1.14.tar.gz
1. ./configure --prefix=/usr/local
2. 在make的时遇到如下错误:
./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)
解决方法如下:vi srclib/stdio.h
找到
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
然后去掉:
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
改成:
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
3. 后重新make && make install,问题解决。
============================================================================================================
Linux下libiconv库的安装和使用,有需要的朋友可以参考一下。
Linux下libiconv库的安装和使用:
1.libiconv包的下载路径
包的下载页面http://www.gnu.org/software/libiconv/
2.编译安装libiconv库
$tar zxvflibiconv-1.14.tar.gz
$cdlibiconv-1.14
$ ./configure --prefix=/usr/local
$ make
$ make install
在/usr/local/lib/目录下,拷备需要的库文件libcharset.so.1, libiconv.so.2。
3.在makefiel文件中使用-liconv调用libiconv动态库文件时,若出现“error while loading sharedlibraries: libiconv.so.2”错误,解决方法为:
$updatedb
$locate libiconv.so.2
发现该库已经安装,位置在/usr/local/lib/libiconv.so.2。既然已经安装,为什么提示找不到?继续下一步排查。
$strace ./indexer 将打印出所有indexer 启动时调用的文件及程序名称,
在输出的信息中,发现查找库libiconv.so.2的路径是/lib目录和/usr/lib这两个目录。
好了,问题找到了,将/usr/local/lib下面该库链接到/usr/lib下面即可
$ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
$ldconfig
至此,解决该问题。