TECHIES WORLD

For Techs.... Techniques.... Technologies....

CpanelLinux

Nagios plugin installation error in Centos7

Centos7 may show an error while installing nagios plugins in it.


In file included from localcharset.c:28:0:
./stdio.h:456:1: error: ‘gets’ undeclared here (not in a function)
make[4]: *** [localcharset.o] Error 1
make[4]: Leaving directory `/root/nagios-plugins-1.4.16/gl'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/root/nagios-plugins-1.4.16/gl'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/nagios-plugins-1.4.16/gl'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/nagios-plugins-1.4.16'
make: *** [all] Error 2

This is a common failure on recent distributions having their glibc not declaring 'gets' anymore. Nagios Plugins with embedded gnulib will fail the compilation during make. The problem can be resolved by following the steps below.

Edit the nagios-plugins-1.4.16/gl/stdio.in.h file and search for the lines,
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
Append the following if statement,
#if defined gets
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
Now you can complete the installation without any issues.

Leave a Reply