centos7编译libiconv报错:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)
今天在centos7上安装lnmp环境的时候,进行make的时候报如下错误:
In file included from progname.c:26:0:
./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
^
make[2]: *** [progname.o] Error 1
make[2]: Leaving directory `/usr/local/src/zabbix-2.4.7/libiconv-1.14/srclib'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/src/zabbix-2.4.7/libiconv-1.14/srclib'
make: *** [all] Error 2
先找到stdio.in.h
vi $HOME/libiconv-1.14/srclib/stdio.in.h
然后跳到698行,把
_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)
然后重新编译libiconv就可以了.
评论: