dhcpcd icon indicating copy to clipboard operation
dhcpcd copied to clipboard

Build fails on macOS due to incorrect headers

Open barracuda156 opened this issue 4 months ago • 2 comments

There are a lot of errors due to incorrect macros leading to inclusion of non-existing headers or function signature conflicts:

--->  Configuring dhcpcd
Executing:  cd "/opt/local/var/macports/build/dhcpcd-7d64e5b5/work/dhcpcd-10.2.4" && ./configure --prefix=/opt/local --build=powerpc-apple-darwin --datadir=/opt/local/share/examples --disable-silent-rules --prefix=/opt/local --privsepuser="_dhcp" --with-openssl --without-udev 
configure args: --prefix=/opt/local --build=powerpc-apple-darwin --datadir=/opt/local/share/examples --disable-silent-rules --prefix=/opt/local --privsepuser=_dhcp --with-openssl --without-udev
Deriving operating system from ... powerpc-apple-darwin
Configuring dhcpcd for ... darwin
Enabling INET support
Enabling ARP support
Enabling ARPing support
Enabling IPv4LL support
Enabling INET6 support
Enabling DHCPv6 support
Enabling Authentication
Enabling Privilege Separation
_dhcp
Using compiler .. /opt/local/bin/gcc-mp-14
gcc-mp-14 (MacPorts gcc14 14.2.0_2+G5+stdlib_flag) 14.2.0
Testing for capsicum ... no
Testing for pledge ... no
dhcpcd-definitions.conf will be embedded in dhcpcd itself
Testing for ifam_pid ... no
Testing for ifam_addrflags ... no
Testing for getifaddrs ... yes
Testing for ifaddrs.ifa_addrflags ... no
Testing for clock_gettime ... yes (-lMacportsLegacySupport)
Testing for closefrom ... no
Testing ioctl request type ... unsigned long
Testing for inet_ntoa ... yes
Testing for arc4random ... yes
Testing for arc4random_uniform ... no
Testing for memset_explicit ... no
Testing for explicit_bzero ... no
Testing for memset_s ... no
Testing for open_memstream ... no
WARNING: Ensure that /tmp exists in the privsep users chroot
Testing for pidfile_lock ... no
Testing for setproctitle ... no
Testing for strlcpy ... yes
Testing for strtoi ... no
Testing for consttime_memequal ... no
Testing for timingsafe_bcmp ... no
Testing for dprintf ... no
Testing for TAILQ_FOREACH_SAFE ... yes
Testing for TAILQ_CONCAT ...yes
Testing for rb_tree_init ... no
Testing for reallocarray ... no
Testing for ppoll ... no
Testing for pollts ... no
Testing for pselect ... yes
Testing for be64enc ... no
Testing for fls64 ... no
Testing for MD5Init ... no
Testing for sha2.h ... no
Testing for SHA256_Init ... no
Testing for SHA256Init ... no
Testing for hmac ... no
Testing for openssl ... yes
Testing for openssl/sha.h ... no
Checking for ntpd ... /usr/sbin/ntpd (50-ntp.conf)
Checking for chronyd ... not found
Checking for timesyncd ... not found
Checking for ypbind ... /usr/sbin/ypbind (50-ypbind NetBSD)

   SYSCONFDIR =        /opt/local/etc
   SBINDIR =        /opt/local/sbin
   LIBDIR =        /opt/local/lib
   LIBEXECDIR =        /opt/local/libexec
   DBDIR =        /var/db/dhcpcd
   RUNDIR =        /var/run/dhcpcd
   MANDIR =        /opt/local/share/man
   DATADIR =        /opt/local/share/examples
   HOOKSCRIPTS =    50-ntp.conf
   EGHOOKSCRIPTS =    50-ypbind
   STATUSARG =        
   PRIVSEPUSER =    _dhcp

Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled:
  pledge: found in dhcpcd-10.2.4/config.log
  closefrom: found in dhcpcd-10.2.4/config.log
  memset_explicit: found in dhcpcd-10.2.4/config.log
  explicit_bzero: found in dhcpcd-10.2.4/config.log
  memset_s: found in dhcpcd-10.2.4/config.log
  pidfile_lock: found in dhcpcd-10.2.4/config.log
  setproctitle: found in dhcpcd-10.2.4/config.log
  strtoi: found in dhcpcd-10.2.4/config.log
  consttime_memequal: found in dhcpcd-10.2.4/config.log
  timingsafe_bcmp: found in dhcpcd-10.2.4/config.log
  reallocarray: found in dhcpcd-10.2.4/config.log
  ppoll: found in dhcpcd-10.2.4/config.log
  pollts: found in dhcpcd-10.2.4/config.log
  SHA256_Init: found in dhcpcd-10.2.4/config.log
  SHA256Init: found in dhcpcd-10.2.4/config.log
  hmac: found in dhcpcd-10.2.4/config.log
--->  Building dhcpcd
Executing:  cd "/opt/local/var/macports/build/dhcpcd-7d64e5b5/work/dhcpcd-10.2.4" && /usr/bin/make -j6 -w all 
make: Entering directory `/opt/local/var/macports/build/dhcpcd-7d64e5b5/work/dhcpcd-10.2.4'
for x in src hooks; do cd $x; /usr/bin/make all || exit $?; cd ..; done
make[1]: Entering directory `/opt/local/var/macports/build/dhcpcd-7d64e5b5/work/dhcpcd-10.2.4/src'
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c common.c -o common.o
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c control.c -o control.o
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c dhcpcd.c -o dhcpcd.o
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c duid.c -o duid.o
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c eloop.c -o eloop.o
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c logerr.c -o logerr.o
In file included from ../config.h:20,
                 from eloop.c:77:
../compat/setproctitle.h:39:1: error: static declaration of 'getprogname' follows non-static declaration
   39 | getprogname(void)
      | ^~~~~~~~~~~
In file included from /opt/local/include/LegacySupport/stdlib.h:37,
                 from eloop.c:71:
/usr/include/stdlib.h:295:10: note: previous declaration of 'getprogname' with type 'const char *(void)'
  295 |         *getprogname(void);
      |          ^~~~~~~~~~~
../compat/setproctitle.h:44:1: error: conflicting types for 'setprogname'; have 'void(char *)'
   44 | setprogname(char *name)
      | ^~~~~~~~~~~
/usr/include/stdlib.h:325:10: note: previous declaration of 'setprogname' with type 'void(const char *)'
  325 | void     setprogname(const char *);
      |          ^~~~~~~~~~~
In file included from ../config.h:20,
                 from dhcpcd.h:37,
                 from common.c:40:
../compat/setproctitle.h:39:1: error: static declaration of 'getprogname' follows non-static declaration
   39 | getprogname(void)
      | ^~~~~~~~~~~
In file included from /opt/local/include/LegacySupport/stdlib.h:37,
                 from common.c:36:
/usr/include/stdlib.h:295:10: note: previous declaration of 'getprogname' with type 'const char *(void)'
  295 |         *getprogname(void);
      |          ^~~~~~~~~~~
../compat/setproctitle.h:44:1: error: conflicting types for 'setprogname'; have 'void(char *)'
   44 | setprogname(char *name)
      | ^~~~~~~~~~~
/usr/include/stdlib.h:325:10: note: previous declaration of 'setprogname' with type 'void(const char *)'
  325 | void     setprogname(const char *);
      |          ^~~~~~~~~~~
In file included from ../config.h:27:
../compat/rbtree.h:50:10: fatal error: sys/endian.h: No such file or directory
   50 | #include <sys/endian.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
In file included from ../config.h:20,
                 from control.c:42:
../compat/setproctitle.h:39:1: error: static declaration of 'getprogname' follows non-static declaration
   39 | getprogname(void)
      | ^~~~~~~~~~~
In file included from /opt/local/include/LegacySupport/stdlib.h:37,
                 from control.c:37:
/usr/include/stdlib.h:295:10: note: previous declaration of 'getprogname' with type 'const char *(void)'
  295 |         *getprogname(void);
      |          ^~~~~~~~~~~
../compat/setproctitle.h:44:1: error: conflicting types for 'setprogname'; have 'void(char *)'
   44 | setprogname(char *name)
      | ^~~~~~~~~~~
/usr/include/stdlib.h:325:10: note: previous declaration of 'setprogname' with type 'void(const char *)'
  325 | void     setprogname(const char *);
      |          ^~~~~~~~~~~
In file included from ../config.h:27:
../compat/rbtree.h:50:10: fatal error: sys/endian.h: No such file or directory
   50 | #include <sys/endian.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
In file included from ../config.h:20,
                 from dhcpcd.c:53:
../compat/setproctitle.h:39:1: error: static declaration of 'getprogname' follows non-static declaration
   39 | getprogname(void)
      | ^~~~~~~~~~~
In file included from /opt/local/include/LegacySupport/stdlib.h:37,
                 from dhcpcd.c:47:
/usr/include/stdlib.h:295:10: note: previous declaration of 'getprogname' with type 'const char *(void)'
  295 |         *getprogname(void);
      |          ^~~~~~~~~~~
../compat/setproctitle.h:44:1: error: conflicting types for 'setprogname'; have 'void(char *)'
   44 | setprogname(char *name)
      | ^~~~~~~~~~~
/usr/include/stdlib.h:325:10: note: previous declaration of 'setprogname' with type 'void(const char *)'
  325 | void     setprogname(const char *);
      |          ^~~~~~~~~~~
make[1]: *** [eloop.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [common.o] Error 1
In file included from ../config.h:27:
../compat/rbtree.h:50:10: fatal error: sys/endian.h: No such file or directory
   50 | #include <sys/endian.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
In file included from ../config.h:27:
../compat/rbtree.h:50:10: fatal error: sys/endian.h: No such file or directory
   50 | #include <sys/endian.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [dhcpcd.o] Error 1
make[1]: *** [control.o] Error 1
In file included from ../config.h:20,
                 from dhcpcd.h:37,
                 from duid.c:53:
../compat/setproctitle.h:39:1: error: static declaration of 'getprogname' follows non-static declaration
   39 | getprogname(void)
      | ^~~~~~~~~~~
In file included from /opt/local/include/LegacySupport/stdlib.h:37,
                 from duid.c:47:
/usr/include/stdlib.h:295:10: note: previous declaration of 'getprogname' with type 'const char *(void)'
  295 |         *getprogname(void);
      |          ^~~~~~~~~~~
../compat/setproctitle.h:44:1: error: conflicting types for 'setprogname'; have 'void(char *)'
   44 | setprogname(char *name)
      | ^~~~~~~~~~~
/usr/include/stdlib.h:325:10: note: previous declaration of 'setprogname' with type 'void(const char *)'
  325 | void     setprogname(const char *);
      |          ^~~~~~~~~~~
In file included from ../config.h:27:
../compat/rbtree.h:50:10: fatal error: sys/endian.h: No such file or directory
   50 | #include <sys/endian.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [duid.o] Error 1


In file included from /usr/include/ppc/param.h:33,
                 from /usr/include/machine/param.h:35,
                 from /usr/include/sys/param.h:110,
                 from duid.c:32:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
In file included from /usr/include/ppc/param.h:33,
                 from /usr/include/machine/param.h:35,
                 from /usr/include/sys/param.h:110,
                 from common.h:32,
                 from common.c:39:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
In file included from /usr/include/machine/_param.h:29,
                 from /usr/include/sys/socket.h:77,
                 from /opt/local/include/LegacySupport/sys/socket.h:27,
                 from dhcpcd.c:32:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
In file included from /usr/include/machine/_param.h:29,
                 from /usr/include/sys/socket.h:77,
                 from /opt/local/include/LegacySupport/sys/socket.h:27,
                 from control.c:29:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
In file included from /usr/include/ppc/param.h:33,
                 from /usr/include/machine/param.h:35,
                 from /usr/include/sys/param.h:110,
                 from if.c:29:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c route.c -o route.o
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c dhcp-common.c -o dhcp-common.o
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c script.c -o script.o
In file included from /usr/include/ppc/param.h:33,
                 from /usr/include/machine/param.h:35,
                 from /usr/include/sys/param.h:110,
                 from ../src/common.h:32,
                 from ../compat/rbtree.h:36,
                 from ../config.h:27,
                 from route.c:39:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
In file included from /usr/include/ppc/param.h:33,
                 from /usr/include/machine/param.h:35,
                 from /usr/include/sys/param.h:110,
                 from ../src/common.h:32,
                 from ../compat/rbtree.h:36,
                 from ../config.h:27,
                 from dhcp-common.c:39:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c auth.c -o auth.o
In file included from /usr/include/machine/_param.h:29,
                 from /usr/include/sys/socket.h:77,
                 from /opt/local/include/LegacySupport/sys/socket.h:27,
                 from /usr/include/netinet/in.h:85,
                 from script.c:33:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c if-bsd.c -o if-bsd.o
In file included from /usr/include/ppc/param.h:33,
                 from /usr/include/machine/param.h:35,
                 from /usr/include/sys/param.h:110,
                 from ../src/common.h:32,
                 from ../compat/rbtree.h:36,
                 from ../config.h:27,
                 from auth.c:42:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
/opt/local/bin/gcc-mp-14  -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -std=c99  -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_DARWIN_C_SOURCE -DHAVE_CONFIG_H -DNDEBUG -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -I.. -I../src -I./crypt -c dhcp.c -o dhcp.o
if-bsd.c:57:10: fatal error: net/if_vlan_var.h: No such file or directory
   57 | #include <net/if_vlan_var.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [if-bsd.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from /usr/include/ppc/param.h:33,
                 from /usr/include/machine/param.h:35,
                 from /usr/include/sys/param.h:110,
                 from dhcp.c:29:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
dhcp.c: In function 'dhcp_readudp':
dhcp.c:3829:21: error: variable-sized object may not be initialized except with an empty initializer
 3829 |         } cmsgbuf = { .buf = { 0 } };
      |                     ^
make[1]: *** [dhcp.o] Error 1


ipv6nd.c: In function 'ipv6nd_sendrsprobe':
ipv6nd.c:362:21: error: variable-sized object may not be initialized except with an empty initializer
  362 |         } cmsgbuf = { .buf = { 0 } };
      |                     ^
ipv6nd.c: In function 'ipv6nd_handledata':
ipv6nd.c:1964:21: error: variable-sized object may not be initialized except with an empty initializer
 1964 |         } cmsgbuf = { .buf = { 0 } };
      |                     ^
dhcp6.c: In function 'dhcp6_sendmessage':
dhcp6.c:1356:21: error: variable-sized object may not be initialized except with an empty initializer
 1356 |         } cmsgbuf = { .buf = { 0 } };
      |                     ^
make[1]: *** [ipv6nd.o] Error 1


if-bsd.c: In function 'if_carrier':
if-bsd.c:422:16: error: 'const struct if_data' has no member named 'ifi_link_state'
  422 |         if (ifi->ifi_link_state >= LINK_STATE_UP)
      |                ^~
ipv6nd.c: In function 'ipv6nd_sendrsprobe':
ipv6nd.c:362:21: error: variable-sized object may not be initialized except with an empty initializer
  362 |         } cmsgbuf = { .buf = { 0 } };
      |                     ^
In file included from /usr/include/machine/_param.h:29,
                 from /usr/include/sys/socket.h:77,
                 from /opt/local/include/LegacySupport/sys/socket.h:27,
                 from privsep-root.c:30:
privsep.h:100:59: warning: variably modified 'psm_data' at file scope
  100 |                                  CMSG_SPACE(sizeof(struct in6_pktinfo) + \
      |                                                           ^~~~~~~~~~~
privsep.h:170:26: note: in expansion of macro 'PS_BUFLEN'
  170 |         uint8_t psm_data[PS_BUFLEN];
      |                          ^~~~~~~~~
dhcp6.c: In function 'dhcp6_recv':
ipv6nd.c: In function 'ipv6nd_handledata':
dhcp6.c:3902:21: error: variable-sized object may not be initialized except with an empty initializer
 3902 |         } cmsgbuf = { .buf = { 0 } };
      |                     ^
ipv6nd.c:1964:21: error: variable-sized object may not be initialized except with an empty initializer
 1964 |         } cmsgbuf = { .buf = { 0 } };
      |                     ^
if-bsd.c:422:36: error: 'LINK_STATE_UP' undeclared (first use in this function)
  422 |         if (ifi->ifi_link_state >= LINK_STATE_UP)
      |                                    ^~~~~~~~~~~~~
if-bsd.c:422:36: note: each undeclared identifier is reported only once for each function it appears in
if-bsd.c:424:16: error: 'const struct if_data' has no member named 'ifi_link_state'
  424 |         if (ifi->ifi_link_state == LINK_STATE_UNKNOWN) {
      |                ^~
make[1]: *** [ipv6nd.o] Error 1
make[1]: *** Waiting for unfinished jobs....
dhcp.c: In function 'dhcp_readudp':
dhcp.c:3829:21: error: variable-sized object may not be initialized except with an empty initializer
 3829 |         } cmsgbuf = { .buf = { 0 } };
      |                     ^
make[1]: *** [dhcp6.o] Error 1
if-bsd.c:424:36: error: 'LINK_STATE_UNKNOWN' undeclared (first use in this function); did you mean 'LINK_UNKNOWN'?
  424 |         if (ifi->ifi_link_state == LINK_STATE_UNKNOWN) {
      |                                    ^~~~~~~~~~~~~~~~~~
      |                                    LINK_UNKNOWN
if-bsd.c: In function 'if_vlanid':
if-bsd.c:555:16: error: variable 'vlr' has initializer but incomplete type
  555 |         struct vlanreq vlr = { .vlr_tag = 0 };
      |                ^~~~~~~
if-bsd.c:555:33: error: 'struct vlanreq' has no member named 'vlr_tag'
  555 |         struct vlanreq vlr = { .vlr_tag = 0 };
      |                                 ^~~~~~~
if-bsd.c:555:43: warning: excess elements in struct initializer
  555 |         struct vlanreq vlr = { .vlr_tag = 0 };
      |                                           ^
if-bsd.c:555:43: note: (near initialization for 'vlr')
if-bsd.c:555:24: error: storage size of 'vlr' isn't known
  555 |         struct vlanreq vlr = { .vlr_tag = 0 };
      |                        ^~~
if-bsd.c: In function 'if_sysctl':
if-bsd.c:963:23: warning: passing argument 1 of 'sysctl' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  963 |         return sysctl(name, namelen, oldp, oldlenp, newp, newlen);
      |                       ^~~~
In file included from if-bsd.c:33:
/usr/include/sys/sysctl.h:751:16: note: expected 'int *' but argument is of type 'const int *'
  751 | int     sysctl(int *, u_int, void *, size_t *, void *, size_t);
      |                ^~~~~
if-bsd.c: At top level:
if-bsd.c:1248:50: warning: 'struct if_announcemsghdr' declared inside parameter list will not be visible outside of this definition or declaration
 1248 | if_announce(struct dhcpcd_ctx *ctx, const struct if_announcemsghdr *ifan)
      |                                                  ^~~~~~~~~~~~~~~~~
if-bsd.c: In function 'if_announce':
if-bsd.c:1251:17: error: invalid use of undefined type 'const struct if_announcemsghdr'
 1251 |         if (ifan->ifan_msglen < sizeof(*ifan)) {
      |                 ^~
if-bsd.c:1251:39: error: invalid application of 'sizeof' to incomplete type 'const struct if_announcemsghdr'
 1251 |         if (ifan->ifan_msglen < sizeof(*ifan)) {
      |                                       ^
if-bsd.c:1256:20: error: invalid use of undefined type 'const struct if_announcemsghdr'
 1256 |         switch(ifan->ifan_what) {
      |                    ^~
make[1]: *** [dhcp.o] Error 1
if-bsd.c:1257:14: error: 'IFAN_ARRIVAL' undeclared (first use in this function)
 1257 |         case IFAN_ARRIVAL:
      |              ^~~~~~~~~~~~
if-bsd.c:1258:59: error: invalid use of undefined type 'const struct if_announcemsghdr'
 1258 |                 return dhcpcd_handleinterface(ctx, 1, ifan->ifan_name);
      |                                                           ^~
if-bsd.c:1259:14: error: 'IFAN_DEPARTURE' undeclared (first use in this function)
 1259 |         case IFAN_DEPARTURE:
      |              ^~~~~~~~~~~~~~
if-bsd.c:1260:60: error: invalid use of undefined type 'const struct if_announcemsghdr'
 1260 |                 return dhcpcd_handleinterface(ctx, -1, ifan->ifan_name);
      |                                                            ^~
if-bsd.c: In function 'if_ifa':
if-bsd.c:1456:2: warning: #warning No SIOCGIFALIAS support [-Wcpp]
 1456 | #warning No SIOCGIFALIAS support
      |  ^~~~~~~
if-bsd.c: In function 'if_dispatch':
if-bsd.c:1588:2: warning: #warning cannot detect route socket overflow within kernel [-Wcpp]
 1588 | #warning cannot detect route socket overflow within kernel
      |  ^~~~~~~
if-bsd.c: In function 'if_missfilter_apply':
if-bsd.c:1657:2: warning: #warning kernel does not support RTM_MISS DST filtering [-Wcpp]
 1657 | #warning kernel does not support RTM_MISS DST filtering
      |  ^~~~~~~
if-bsd.c: In function 'if_applyra':
if-bsd.c:1777:2: warning: #warning OS does not allow setting of RA bits hoplimit, retrans or reachable [-Wcpp]
 1777 | #warning OS does not allow setting of RA bits hoplimit, retrans or reachable
      |  ^~~~~~~
make[1]: *** [if-bsd.o] Error 1

I am not yet sure about error: variable-sized object may not be initialized except with an empty initializer.

sys/endian.h does not exist on macOS, there are machine/endiah.h, if that is needed, otherwise the local endian.h perhaps can be used. net/if_vlan_var.h does not exist at least on some macOS versions.

barracuda156 avatar Aug 21 '25 22:08 barracuda156

So while we can likely fix a lot of the header issues, my concern is that we won't work with the kernel at all.

For example on BSD we use route(4) and on Linux we use rtnetlink. Does one of these work on Darwin? If so then it might be possible. It took a long time and a lot of research to get Illumed supported and I don't have that time right now.

rsmarples avatar Sep 02 '25 14:09 rsmarples

@rsmarples route(4) should work, and back to very old macOS versions. See: https://leopard-adc.pepas.com/documentation/Darwin/Reference/ManPages/man4/route.4.html Generally speaking, a lot of BSD stuff will be supported (though not everything, admittedly). Less so for linuxisms, I think.

barracuda156 avatar Sep 02 '25 15:09 barracuda156