一、实验报错如下:

make[2]:Enteringdirectory`/home/chen/tools/libiconv-1.14/srclib'make[3]:Enteringdirectory`/home/chen/tools/libiconv-1.14'make[3]:Nothingtobedonefor`am--refresh'.make[3]:Leavingdirectory`/home/chen/tools/libiconv-1.14'gcc-DHAVE_CONFIG_H-DEXEEXT=\"\"-I.-I..-I../lib-I../intl-DDEPENDS_ON_LIBICONV=1-DDEPENDS_ON_LIBINTL=1-g-O2-cprogname.cInfileincludedfromprogname.c:26:0:./stdio.h:1010:2:error:invalidpreprocessingdirective#_GL_WARN_ON_USE_GL_WARN_ON_USE(gets,"getsisasecurityhole-usefgetsinstead");make[2]:***[progname.o]Error1fontmake[2]:Leavingdirectory`/home/chen/tools/libiconv-1.14/srclib'make[1]:***[all]Error2make[1]:Leavingdirectory`/home/chen/tools/libiconv-1.14/srclib'make:***[all]Error2

二、解决方法

编辑/home/chen/tools/libiconv-1.14/srclib下的stdio.in.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

注意:上面为两个#endif保存退出,重新编译。

make && make install