Skip to content

#include <sys/socket.h> with -D_GNU_SOURCE fails to build with clang #13

Open
@cmorve-te

Description

@cmorve-te

If you take this program

#include <sys/socket.h>
void test(){}

which builds with no issues with clang -O1 -D_GNU_SOURCE -o /dev/null -c test.c.

And use OpenOSC 1.0.7, it fails with

$ clang -O1 -D_GNU_SOURCE -o /dev/null -c test.c -include /usr/include/openosc.h 
In file included from test.c:1:
/usr/include/sys/socket.h:163:16: error: at most one overload for a given name may lack the 'overloadable' attribute
  163 | extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
      |                ^
/usr/include/openosc_fortify_extern.h:159:16: note: previous unmarked overload of function is here
  159 | extern ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) ;
      |                ^
1 error generated.

This seems to happen because glibc uses a special sockaddr definition: https://sourceware.org/git/?p=glibc.git;a=blob;f=socket/sys/socket.h;h=e72f5e722e4cd6ca5e04fe05b94dcf2963c3b124;hb=HEAD#l80

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions