Psutil version: 5.9.8 plus patches to fix #2360 and #2362
Python version: any
Type: installation
Description
Build failure on old versions of macOS (prior to 10.9):
In file included from psutil/arch/osx/net.c:12:
/usr/include/net/if.h:306:19: error: field has incomplete type 'struct sockaddr'
struct sockaddr ifru_addr;
^
/usr/include/net/if.h:306:10: note: forward declaration of 'struct sockaddr'
struct sockaddr ifru_addr;
^
/usr/include/net/if.h:307:19: error: field has incomplete type 'struct sockaddr'
struct sockaddr ifru_dstaddr;
^
/usr/include/net/if.h:306:10: note: forward declaration of 'struct sockaddr'
struct sockaddr ifru_addr;
^
/usr/include/net/if.h:308:19: error: field has incomplete type 'struct sockaddr'
struct sockaddr ifru_broadaddr;
^
/usr/include/net/if.h:306:10: note: forward declaration of 'struct sockaddr'
struct sockaddr ifru_addr;
^
/usr/include/net/if.h:352:18: error: field has incomplete type 'struct sockaddr'
struct sockaddr ifra_addr;
^
/usr/include/net/if.h:306:10: note: forward declaration of 'struct sockaddr'
struct sockaddr ifru_addr;
^
/usr/include/net/if.h:353:18: error: field has incomplete type 'struct sockaddr'
struct sockaddr ifra_broadaddr;
^
/usr/include/net/if.h:306:10: note: forward declaration of 'struct sockaddr'
struct sockaddr ifru_addr;
^
/usr/include/net/if.h:354:18: error: field has incomplete type 'struct sockaddr'
struct sockaddr ifra_mask;
^
/usr/include/net/if.h:306:10: note: forward declaration of 'struct sockaddr'
struct sockaddr ifru_addr;
^
/usr/include/net/if.h:437:26: error: field has incomplete type 'struct sockaddr_storage'
struct sockaddr_storage addr; /* in/out */
^
/usr/include/net/if.h:437:9: note: forward declaration of 'struct sockaddr_storage'
struct sockaddr_storage addr; /* in/out */
^
/usr/include/net/if.h:438:26: error: field has incomplete type 'struct sockaddr_storage'
struct sockaddr_storage dstaddr; /* out */
^
/usr/include/net/if.h:437:9: note: forward declaration of 'struct sockaddr_storage'
struct sockaddr_storage addr; /* in/out */
^
8 errors generated.
This is a common problem, caused by <net/if.h> on OS X versions earlier than 10.9 not including <sys/socket.h>. The solution is to include <sys/socket.h> yourself before including <net/if.h>. (So much for my recommendation to include headers in alphabetical order!) I'll send a PR.
Summary
Description
Build failure on old versions of macOS (prior to 10.9):
This is a common problem, caused by <net/if.h> on OS X versions earlier than 10.9 not including <sys/socket.h>. The solution is to include <sys/socket.h> yourself before including <net/if.h>. (So much for my recommendation to include headers in alphabetical order!) I'll send a PR.