Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#61314 closed defect (fixed)

unbound @1.12.0: error: use of undeclared identifier 'IF_NAMESIZE'

Reported by: chrstphrchvz (Christopher Chavez) Owned by: nerdling (Jeremy Lavergne)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc: iefdev (Eric F)
Port: unbound

Description

Build fails on 10.8 and earlier:

services/listen_dnsport.c:1411:40: error: use of undeclared identifier 'IF_NAMESIZE'
                char addr_buf[INET6_ADDRSTRLEN + 1 + IF_NAMESIZE + 1 + 16 + 1];
                                                     ^
services/listen_dnsport.c:1447:23: error: use of undeclared identifier 'IF_NAMESIZE'
                        char if_index_name[IF_NAMESIZE + 1];
                                           ^
services/listen_dnsport.c:1453:4: warning: implicit declaration of function 'if_indextoname' is invalid in C99 [-Wimplicit-function-declaration]
                        if_indextoname(in6->sin6_scope_id,
                        ^
1 warning and 2 errors generated.

This is because during configuration net/if.h (which defines IF_NAMESIZE) isn't detected, so HAVE_NET_IF_H isn't defined and net/if.h won't be included by source files:

checking for net/if.h... no

Without digging into the configuration check, I'm inclined to think this is similar to #55238 where sys/socket.h needs to be included when using net/if.h on 10.8 and earlier; a future release of legacysupport will include sys/socket.h automatically ([ea4b467559/macports-legacy-support]).

Attachments (2)

config.log (431.4 KB) - added by jmroot (Joshua Root) 4 years ago.
patch-ifaddr-net_if.diff (350 bytes) - added by iefdev (Eric F) 4 years ago.

Download all attachments as: .zip

Change History (16)

Changed 4 years ago by jmroot (Joshua Root)

Attachment: config.log added

comment:1 Changed 4 years ago by jmroot (Joshua Root)

Even on current systems, the man page for if_indextoname specifies multiple includes in the synopsis:

     #include <sys/types.h>
     #include <sys/socket.h>
     #include <net/if.h>

Should probably split net/if.h into its own AC_CHECK_HEADERS with an additional sys/socket.h conditional include on top of the ones in AC_INCLUDES_DEFAULT.

comment:2 Changed 4 years ago by jmroot (Joshua Root)

comment:3 Changed 4 years ago by kencu (Ken)

the current release of legacy-support has the net/if.h fix in it.

comment:4 Changed 4 years ago by iefdev (Eric F)

This got it to work for me. Don't know if the names are the same on all versions though.

  • services/listen_dnsport.c

    old new  
    7171#include <systemd/sd-daemon.h>
    7272#endif
    7373
     74#if __APPLE__
     75  #define HAVE_IFADDRS_H _IFADDRS_H_
     76  #define HAVE_NET_IF_H _NET_IF_H_
     77#endif
     78
    7479#ifdef HAVE_IFADDRS_H
    7580#include <ifaddrs.h>
    7681#endif

Changed 4 years ago by iefdev (Eric F)

Attachment: patch-ifaddr-net_if.diff added

comment:5 Changed 4 years ago by iefdev (Eric F)

Cc: iefdev added

comment:6 Changed 4 years ago by iefdev (Eric F)

If it's <= 10.8, I should prob use: #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1080 instead.

comment:7 Changed 4 years ago by kencu (Ken)

or instead of all this - pretty sure - just add legacysupport and you're done, I think. Haven't tried it, tho.

comment:8 in reply to:  7 ; Changed 4 years ago by iefdev (Eric F)

Replying to kencu:

or instead of all this - pretty sure - just add legacysupport and you're done, I think. Haven't tried it, tho.

Both 1.0 and 1.1 worked… Go with legacysupport 1.1?

comment:9 Changed 4 years ago by nerdling (Jeremy Lavergne)

Status: assignedaccepted

chrstphrchvz also has a PR for 10.8 issues around undefined symbols: will the portgroup addition meld well with those changes?

https://github.com/macports/macports-ports/pull/8776/files

Last edited 4 years ago by nerdling (Jeremy Lavergne) (previous) (diff)

comment:10 in reply to:  9 Changed 4 years ago by nerdling (Jeremy Lavergne)

Replying to nerdling: Whoops, mixing up Ports.

comment:11 in reply to:  8 ; Changed 4 years ago by kencu (Ken)

Replying to iefdev:

Go with legacysupport 1.1?

that's what I would do, but it's the perennial practical vs. purity argument, and I always come down on the side of practical.

comment:12 in reply to:  11 Changed 4 years ago by iefdev (Eric F)

Replying to kencu:

Replying to iefdev:

Go with legacysupport 1.1?

that's what I would do, but it's the perennial practical vs. purity argument, and I always come down on the side of practical.

I went with that:

$ port -v installed unbound
The following ports are currently installed:
  unbound @1.12.0_1+nghttp2-universal (active) platform='darwin 11' archs='x86_64' date='2020-10-14T19:54:27+0200'

comment:13 Changed 4 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: acceptedclosed

In 566bb98308935e4e8203b6a40eed052ab64de675/macports-ports (master):

unbound: fix check for net/if.h

Closes: #61314

comment:14 Changed 4 years ago by iefdev (Eric F)

In 3abb85caeb7d15ab40f97b56fab8737500e0aad5/macports-ports (master):

unbound: add variant nghttp2 (DoH)

New in 1.12.0 is DoH. To use it, nghttp2 is needed.

  • add variant: +nghttp2
  • add depends_lib: nghttp2

Also:

  • add PortGroup legacysupport 1.1
  • Closes: #61314
Note: See TracTickets for help on using tickets.