You are not logged in.
Hi.
I would really like to install nagios and nagios-plugins on my server, but for some reason I can't compile nagios-plugins.
I run the usual
./configure
make
which throws the following output:
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
Any idea on how to solve this ? My system is up-to-date.
Thanks a lot,
Last edited by qdm (2012-07-24 12:12:12)
Offline
https://wiki.archlinux.org/index.php/AUR
http://aur.archlinux.org/packages.php?ID=12307
wget http://aur.archlinux.org/packages/na/nagios-plugins/nagios-plugins.tar.gz
tar xzf nagios-plugins.tar.gz
cd nagios-plugins
makepkg -is
Last edited by fukawi2 (2012-07-23 23:26:05)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I get exactly the same error doing this procedure.
As a matter of fact I downloaded the sources myself and try to build them the old-fashioned way because my AUR wrapper (yaourt) was also unable to build.
Offline
The bug is described here https://bugzilla.redhat.com/show_bug.cg … &id=835621
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.
According to this thread https://bbs.archlinux.org/viewtopic.php?pid=1134524
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' ./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.
edit:
Looks like gentoo did the same quick fix just a couple of weeks ago in their source
http://sources.gentoo.org/cgi-bin/viewv … iew=markup
Last edited by drobole (2012-07-24 10:52:49)
Offline
I finally got it to work !
Thanks a lot !
The above indications helped. What I did was:
Edit the src/nagios-foo/gl/stdio.in.h file with the patch here
Patch applied:
----------
--- nagios-plugins-1.4.15-orig/gl/stdio.in.h 2010-07-27 21:47:15.000000000 +0100
+++ nagios-plugins-1.4.15/gl/stdio.in.h 2012-06-26 21:12:47.000000000 +0100
@@ -140,8 +140,10 @@
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
+#if defined gets
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
----------
Then I ran makepkg -is, it failed as before, and I applied the same patch on the previous file AGAIN, along with the stdio.h file that was alongside it and had been automatically generated.
After that all went well !
Awesome
Offline
Thats cool. After making a change to a in file you typically have to issue the configure command again to have the change applied, so maybe that caused some confusion.
Anyway, grats!
Offline
Hi,
Could you give me some instructions on how you applied the patch.
I tried creating a file in the ~/nagios-plugins-1.4.16/gl directory with the patch you listed, called stdio.in.h.patch, and copied the text you posted into that file.
and ran
patch stdio.in.h < stdio.in.h.patch
I get this result:
patching file stdio.in.h
patch unexpectedly ends in middle of line
patch unexpectedly ends in middle of line
Any help would be appreciated.
Thanks
Offline