Opened 10 years ago

Closed 8 years ago

Last modified 6 years ago

#265 closed bug (fixed)

ancilData breaks link on AIX

Reported by: jgoerzen Owned by: simonmar
Priority: normal Milestone: 6.4.2
Component: libraries/network Version: 6.4.1
Keywords: Cc:
Operating System: AIX Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonmar)

Hello, 
 
When I built a program on AIX using network code, I 
got the following errors during the link stage: 
 
/usr/local/lib/ghc-6.2.1/libHSnetwork.a(ancilData.o)
(.pr+0x31c):cbits/ancilData.c: undefined reference to 
`.CMSG_LEN' 
/usr/local/lib/ghc-6.2.1/libHSnetwork.a(ancilData.o)
(.pr+0x3fc):cbits/ancilData.c: undefined reference to 
`.CMSG_SPACE' 
/usr/local/lib/ghc-6.2.1/libHSnetwork.a(ancilData.o)
(.pr+0x420):cbits/ancilData.c: undefined reference to 
`.CMSG_LEN' 
 
(repeated over and over) 
 
I traced the problem down to ancilData.c.  The 
attached trivial patch is a workaround. 
 
AIX does not define CMSG_LEN or CMSG_SPACE 
anywhere -- unless you 
 
#define _LINUX_SOURCE_COMPAT 
 
before #including sys/socket.h.  (sounds ugly.) 
 
Here's how AIX defines msghdr, BTW: 
 
#if defined(COMPAT_43) && !defined(_KERNEL) 
struct msghdr { 
        caddr_t msg_name;               /* optional address 
*/ 
        int     msg_namelen;            /* size of address */ 
        struct  iovec *msg_iov;         /* scatter/gather 
array */ 
        int     msg_iovlen;             /* # elements in 
msg_iov */ 
        caddr_t msg_accrights;          /* access rights 
sent/received */ 
        int     msg_accrightslen; 
}; 
#else 
struct msghdr { 
        void    *msg_name;              /* optional address 
*/ 
        socklen_t  msg_namelen;         /* size of address 
*/ 
        struct  iovec   *msg_iov;       /* scatter/gather 
array */ 
        int     msg_iovlen;             /* # elements in 
msg_iov */ 
        void    *msg_control;           /* ancillary data, 
see below */ 
        socklen_t  msg_controllen;      /* ancillary data 
buffer len */ 
        int     msg_flags;              /* flags on received 
message */ 
}; 
 
#endif 
 
My little hack tells it to use COMPAT_43.  I suppose you 
could also go the _LINUX_SOURCE_COMPAT route. 
 
In either case, I am not proficient at all with the 
autotools stuff and lack the expertise to craft the 
correct build stuff there, but I'm happy to give you 
whatever information you may need to do that. 

Attachments (1)

diff.2 (402 bytes) - added by jgoerzen 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by jgoerzen

comment:1 Changed 8 years ago by simonmar

  • Description modified (diff)
  • Version changed from None to 6.4.1

comment:2 Changed 8 years ago by simonmar

  • Milestone set to 6.4.2

comment:3 Changed 8 years ago by simonmar

  • Architecture set to Unknown
  • Operating System set to AIX

comment:4 Changed 8 years ago by simonmar

  • Difficulty set to Unknown
  • Resolution changed from None to fixed
  • Status changed from assigned to closed

fixed, thanks. I used the _LINUX_SOURCE_COMPAT route in the end.

comment:5 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.