Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,259
    • Issues 5,259
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 563
    • Merge requests 563
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #265
Closed
Open
Issue created Oct 08, 2004 by jgoerzen@trac-jgoerzen

ancilData breaks link on AIX

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. 
Edited Mar 09, 2019 by Simon Marlow
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking