nagios-plugins

ERROR: Got error on installing nagios-plugin on centos7 “In file included from localcharset.c:26:0:”

Posted on

Build failure on installing nagios plugin on centos7,

Error:

In file included from localcharset.c:26:0:
./stdio.h:456:1: error: ‘gets’ undeclared here (not in a function)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
^
make[4]: *** [localcharset.o] Error 1
make[4]: Leaving directory `/opt/installer/nagios-plugins-1.4.16/gl'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/opt/installer/nagios-plugins-1.4.16/gl'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/installer/nagios-plugins-1.4.16/gl'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/installer/nagios-plugins-1.4.16'
make: *** [all] Error 2

It seems that nagios has created a custom version of the standard stdio.h file so even if the bug has been fixed in the c libraries it may still exists in nagios.

maybe you can do a quick fix by running this command in the same folder as stdio.in.h:

sed -i -e '/gets is a security/d' ./gl/stdio.in.h

Thats just a long shot though, I haven’t tried it myself.
PS. Make a backup copy of stdio.in.h first so you can revert the source back to its original state if it doesn’t work.