[hobbit] problem compiling HP-UX 11.11 using gcc

Henrik Stoerner henrik at hswn.dk
Mon Jun 26 22:49:36 CEST 2006


On Mon, Jun 26, 2006 at 11:23:13AM -0700, Mike Arnold wrote:
> Camp.external at qimonda.com wrote:
> > Have you tried 4.1.1 from this site?
> >
> > http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,7663,00.html
> 
> I have gcc 4.0.3 32-bit, 4.1.1 32 and 64-bit from HP, and 4.1.0 from PaAC.
>  All give the same errors.
> 
> I'm thinking that there must be something different about our build
> environments, as other people have indicated that they are able to compile
> just fine.

I've managed to find out that this breakage is because the HP-UX
include-files do not define the RPC functions and structures if
the pre-processer symbol _XOPEN_SOURCE_EXTENDED is defined. 

This despite the on-line documentation in "man getrpcent" stating
that this function *is* available, if you just include the <netdb.h>
file in your program. Which Hobbit does ...

Now ... why that is so, you'll have to ask HP. I'm prone to consider it
a bug in their include-files, and looking at the contortions they go
through with defining/undefining various things it seems that this may
not be what they intended to do. Just #undef'ing this at the top of
bbtest-net.c causes some other breakage with sys/socket.h disagreeing
with itself about how to define the "sendfile" and "sendpath" functions:

/usr/include/sys/socket.h:504: error: static declaration of 'sendfile' follows non-static declaration
/usr/include/sys/socket.h:484: error: previous declaration of 'sendfile' was here
/usr/include/sys/socket.h:505: error: static declaration of 'sendpath' follows non-static declaration
/usr/include/sys/socket.h:486: error: previous declaration of 'sendpath' was here


For now, the fastest work-around is probably to add this to bbtest-net.c
around line 32 (after the HAVE_RPCENT_H part):

struct rpcent {
	char    *r_name;        /* name of server for this rpc program */
	char    **r_aliases;    /* alias list */
	int     r_number;       /* rpc program number */
};
extern struct rpcent *getrpcbyname(char *);

With that added, Hobbit builds just fine.


Regards,
Henrik




More information about the Xymon mailing list