Why does this compile?

Russell Haley russ.haley at gmail.com
Tue Sep 26 04:38:36 UTC 2017


Hi,

I'm trying to compile the new dotnet core 2.0 and I've run into a C
problem I don't understand. Since I ran the code to check it on my arm
board, I'm going to ask here (the most knowledgeable fbsd C people I
could ask).

The cmake file is trying to test for a linux struct in_pktinfo:

check_c_source_compiles(
    "
    #include <${SOCKET_INCLUDES}>
    int main()
    {
        struct in_pktinfo;
        return 0;
    }
    "
    HAVE_IN_PKTINFO)

SOCKET_INCLUDES resolves to netinet/in.h so the final source is:

#include <netinet/in.h>

int main()
{
    struct in_pktinfo;
    return 0;
}

This compiles on FreeBSD current and apparently on 11 too. That's a
bad thing because it's supposed to fail. I checked in.h and there is
no struct for in_pktinfo. Not surprisingly, if I remove the include
altogether, it still compiles.

I assume then that the original author made a mistake? My C is too
weak and most of my searches don't turn up anything close to what I'm
looking for.

Any suggestions would be awesome.  :)

Thanks,

Russ


More information about the freebsd-arm mailing list