环境:centos 7.2,
make时报以下错:
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: 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/libiconv-1.14/srclib’
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/src/libiconv-1.14/srclib’
make: *** [all] Error 2
解决方法:[root@7-node1 libiconv-1.14]# vi srclib/stdio.in.h 也就是安装目录下的这个文件需要修改,695行到698行修改成下面就可以了,多余的是添加的:
695 /* It is very rare that the developer ever has full control of stdin,
696 so any use of gets warrants an unconditional warning. Assume it is
697 always declared, since it is required by C89.
698 _GL_WARN_ON_USE (gets, “gets is a security hole – use fgets instead”); */
699 #if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
700 _GL_WARN_ON_USE (gets, “gets is a security hole – use fgets instead”);
701 #endif
修改的内容:698行注释掉了,只需要把*/往下移动就可以,本来是在697行的,然后加入699到701行。701行下面还有一个#endif,不要删除了,它是和上面的匹配的。
原文链接:libiconv编译时报错,转载请注明来源!