Opened 3 months ago
Closed 8 weeks ago
#61624 closed defect (fixed)
net-snmp @5.8: error: implicit declaration of function 'get_in_address' is invalid in C99
Reported by: | Prolixium | Owned by: | ryandesign (Ryan Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.6.4 |
Keywords: | bigsur catalina | Cc: | erdinc09, willpush (Will Coulter), amake (Aaron Madlon-Kay), miken32 (Michael Newton) |
Port: | net-snmp |
Description
From what I can tell on a fresh install of macOS Big Sur (11.0.1) and Xcode 12.2 w/MacPorts 2.6.4, net-snmp 5.8 fails to compile:
/bin/sh ../../libtool --mode=compile /usr/bin/clang -I../../include -I. -I../../agent -I../../agent/mibgroup -I../../snmplib -I/opt/local/include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -Udarwin20 -Ddarwin20=darwin20 -c -o mibII/ipAddr.lo mibII/ipAddr.c mibgroup/mibII/ipAddr.c:200:29: error: variable has incomplete type 'struct in_ifaddr' static struct in_ifaddr in_ifaddr, lowin_ifaddr; ^ mibgroup/mibII/ipAddr.c:200:19: note: forward declaration of 'struct in_ifaddr' static struct in_ifaddr in_ifaddr, lowin_ifaddr; ^ mibgroup/mibII/ipAddr.c:200:40: error: variable has incomplete type 'struct in_ifaddr' static struct in_ifaddr in_ifaddr, lowin_ifaddr; ^ mibgroup/mibII/ipAddr.c:200:19: note: forward declaration of 'struct in_ifaddr' static struct in_ifaddr in_ifaddr, lowin_ifaddr; ^ mibgroup/mibII/ipAddr.c:204:25: error: variable has incomplete type 'struct ifnet' static struct ifnet ifnet; ^ mibgroup/mibII/ipAddr.c:204:19: note: forward declaration of 'struct ifnet' static struct ifnet ifnet; ^ mibgroup/mibII/var_route.c:195:29: error: implicit declaration of function 'get_in_address' is invalid in C99 [-Werror,-Wimplicit-function-declaration] cp = (u_char *) get_in_address((struct sockaddr *) (rtp + 1), ^ 3 errors generated. mibgroup/mibII/var_route.c:195:18: warning: cast to 'u_char *' (aka 'unsigned char *') from smaller integer type 'int' [-Wint-to-pointer-cast] cp = (u_char *) get_in_address((struct sockaddr *) (rtp + 1), ^ mibgroup/mibII/var_route.c:235:27: error: implicit declaration of function 'get_in_address' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return (u_char *) get_in_address((struct sockaddr *) (rtp + 1), ^ mibgroup/mibII/var_route.c:235:16: warning: cast to 'u_char *' (aka 'unsigned char *') from smaller integer type 'int' [-Wint-to-pointer-cast] return (u_char *) get_in_address((struct sockaddr *) (rtp + 1), ^ mibgroup/mibII/var_route.c:269:13: warning: cast to 'u_char *' (aka 'unsigned char *') from smaller integer type 'int' [-Wint-to-pointer-cast] return (u_char *) get_in_address((struct sockaddr *) (rtp + 1), ^ mibgroup/mibII/var_route.c:299:20: warning: cast to 'u_char *' (aka 'unsigned char *') from smaller integer type 'int' [-Wint-to-pointer-cast] return (u_char *) get_in_address((struct sockaddr *) (rtp + 1), ^ mibgroup/mibII/var_route.c:2110:1: error: conflicting types for 'get_in_address' get_in_address(const void *ap, int addresses, int wanted) ^ mibgroup/mibII/var_route.c:195:29: note: previous implicit declaration is here cp = (u_char *) get_in_address((struct sockaddr *) (rtp + 1), ^ 4 warnings and 3 errors generated.
If I'm reading the port summary page correctly, there might not be a working build for Catalina either, and Mojave was the last OS where the port built successfully.
I'm attaching net-snmp-build.txt that shows all the messages from the failed build.
Please let me know if there's anything I should try or anything additional I can include in this ticket. Thanks!
Attachments (1)
Change History (12)
Changed 3 months ago by Prolixium
Attachment: | net-snmp-build.txt added |
---|
comment:1 Changed 3 months ago by ryandesign (Ryan Schmidt)
Keywords: | bigsur catalina added |
---|---|
Owner: | set to ryandesign |
Status: | new → assigned |
Summary: | net-snmp @5.8 fails to compile on Big Sur / Xcode 12.2 → net-snmp @5.8: error: implicit declaration of function 'get_in_address' is invalid in C99 |
Version: | → 2.6.4 |
The port summary page is not the final word on whether a port built or not. We do have net-snmp packages available for all OS versions up to and including Catalina; see https://packages.macports.org/net-snmp/
This is the well-known Xcode 12 implicit function declaration issue.
comment:2 Changed 3 months ago by kencu (Ken)
FYI even when I disabled the implicit function issue, it would not build due to this:
error: variable has incomplete type 'struct in_ifaddr'
comment:3 Changed 3 months ago by ryandesign (Ryan Schmidt)
As far as I recall, that error message is also indicative of forgetting to include the right header.
comment:5 Changed 3 months ago by erdinc09
Cc: | erdinc09 added |
---|
comment:6 Changed 3 months ago by willpush (Will Coulter)
Cc: | willpush added |
---|
comment:7 Changed 2 months ago by miken32 (Michael Newton)
Is there anything we can do to help resolve this issue? Any patches to test, or upstream bugs to file? I'm not a C programmer, but my understanding is this function just needs to be pre-declared either at the top of the file or in a header file. Since it violates current C standards, it seems like it's a no-brainer to just add it to the header but I assume there's some drawback?
comment:8 Changed 2 months ago by amake (Aaron Madlon-Kay)
Cc: | amake added |
---|
comment:9 Changed 2 months ago by amake (Aaron Madlon-Kay)
I have an incomplete PR up to bump the version and fix the build, but the last mile is unfortunately beyond my current abilities: https://github.com/macports/macports-ports/pull/9506
If someone could help out that would be great.
comment:10 Changed 2 months ago by miken32 (Michael Newton)
Cc: | miken32 added |
---|
comment:11 Changed 8 weeks ago by Aaron Madlon-Kay <amake@…>
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
build text