[Nagiosplug-help] Compiling in cygwin

Andreas Ericsson ae at op5.se
Tue Feb 1 02:34:54 CET 2005


Vanderveken, Jan wrote:
> 
> I don't want to turn this into a discussion about the merits of Unix vs
> Windows, if you don't mind, so let's please stick to the technical issue at
> hand :)
>  

Sorry about that. It seems I can never resist.

> 
>>The nagios plugins lean heavily on certain system 
>>applications usually 
>>only found on unix systems. I don't think a cygwin port is currently 
>>planned and I seriously doubt if you will have any luck in 
>>making many 
>>of them run.
> 
> 
> Cygwin provides just those system applications you speak about (or should
> anyway). Anyway, I'm a bit surprised that it's so much trouble getting these
> relatively simple plugins to compile, when big applications like Apache and
> MySQL went smoothly.
> 

Apache and MySQL bring all their own code. The plugins rely on other 
packages to exist (like header files from some form of kernel package, 
for instance). Apache and MySQL are also very mature and widespread 
projects where numerous competent coders have contributed clean code to 
make it compile cleanly with everything from gcc to a stick of wood.

> 
>>check_icmp (as included in the dist) won't compile under 
>>CYGWIN unless 
>>you have BSD-compatible headers installed
> 
> 
> I don't really need the check_icmp plugin. So that is ok.
>  

I doubt the check_ping plugin will work properly either, but it should 
be interesting to see.

> 
>>The best option you have is probably to run make -i (continue 
>>on errors) 
>>and take whatever plugins happen to build.
> 
> 
> make -i does indeed build a lot of the plugins, but it does not build the
> most critical I need, namely check_nt. 
> 
> It gave me these errors:
> In file included from check_nt.c:38:
> common.h:35:20: config.h: No such file or directory

I suppose you ran ./configure successfully? Perhaps it's a typo issue in 
check_nt.c. Try downloading latest CVS.

> In file included from check_nt.c:38:
> common.h:146: error: parse error before "va_list"

That's weird. va_list is C89, provided by stdarg.h and should be 
available on all platforms.

> common.h:187:21: gettext.h: No such file or directory
> In file included from check_nt.c:39:
> netutils.h:35:20: config.h: No such file or directory

More ./configure or typo issues.

> In file included from check_nt.c:39:
> netutils.h:39: error: parse error before "socket_timeout_alarm_handler"
> netutils.h:39: warning: data definition has no type or storage class
> In file included from check_nt.c:40:
> utils.h:30: error: parse error before "timeout_alarm_handler"
> utils.h:30: warning: data definition has no type or storage class

It seems cygwin doesn't provide RETSIGTYPE. Since this is very 
platform-specific (Windows doesn't do signals the unix way), I doubt you 
will find a suitable solution.

> utils.h:60: warning: `struct timezone' declared inside parameter list
> utils.h:60: warning: its scope is only this definition or declaration, which
> is
> probably not what you want

That's a bit weird. Try substituting struct timezone * for void * (it 
will give you new warnings about cast this and that, but if the function 
exists it should swallow it nicely and work as intended).

> check_nt.c: In function `main':
> check_nt.c:115: error: `LC_ALL' undeclared (first use in this function)
> check_nt.c:115: error: (Each undeclared identifier is reported only once
> check_nt.c:115: error: for each function it appears in.)
> check_nt.c:116: error: `PACKAGE' undeclared (first use in this function)
> check_nt.c:116: error: `LOCALEDIR' undeclared (first use in this function)
> check_nt.c:120: warning: passing arg 1 of `usage4' makes pointer from
> integer 
> without a cast
> 
> I do have gettext installed in cygwin ... so it seems a little odd.
> 

Try with --disable-nls. There aren't any dutch translations anyway, so 
you won't gain anything by compiling it in.

If that doesn't work, try commenting out the offending code (with 
#ifndef CYGWIN and add -DCYGWIN to your CFLAGS variable). It is nls 
specific anyway, so it shouldn't bother you (and it should be commented 
out with --disable-nls).

It's always nice to see a pioneer porting code to something obscure. ;)

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer




More information about the Help mailing list