编译安装libiconv
cd /usr/local/src
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xfz libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ..
make时遇到错误:
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c allocator.c
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c areadlink.c
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c careadlinkat.c
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c malloca.c
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c progname.c
In file included from progname.c:26:0:
./stdio.h:1010:1: 错误:‘gets’未声明(不在函数内)
_GL_WARN_ON_USE (gets,"gets is a security hole - use fgets instead");
^
ke[2]: *** [progname.o] 错误 1
�ake[2]: 离开目录“/usr/local/src/libiconv-1.14/srclib”
make[1]: *** [all] 错误 2
make[1]: 离开目录“/usr/local/src/libiconv-1.14/srclib”
make: *** [all] 错误 2
解决办法1:
编辑stdio.h文件,将 _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
#endif
解决办法2:
cd srclib/
sed -ir -e '/gets is a security/d' ./stdio.in.h
cd ../
make
重新make即可!
原文链接:https://www.f2er.com/centos/382204.html