Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS Big Sur build failure in mibII icmp with 5.9 #226

Closed
mitchblank opened this issue Dec 13, 2020 · 1 comment
Closed

MacOS Big Sur build failure in mibII icmp with 5.9 #226

mitchblank opened this issue Dec 13, 2020 · 1 comment

Comments

@mitchblank
Copy link
Contributor

Trying to build 5.9 on a MacOS 11 machine (which the net-snmp build scripts identify as darwin20 per the x86_64-apple-darwin20.1.0 that config.guess returns) I get:

Undefined symbols for architecture x86_64:
  "_sysctl_read_icmp6_msg_stat", referenced from:
      import-atom in libnetsnmpmibs.dylib
  "_sysctl_read_icmp6_stat", referenced from:
      import-atom in libnetsnmpmibs.dylib
  "_sysctl_read_icmp_msg_stat", referenced from:
      import-atom in libnetsnmpmibs.dylib
  "_sysctl_read_icmp_stat", referenced from:
      import-atom in libnetsnmpmibs.dylib
ld: symbol(s) not found for architecture x86_64

The basic issue is that those functions are defined in agent/mibgroup/mibII/kernel_sysctl.c but the configure script does not bring that file into the build.

In agent/mibgroup/mibII/icmp.h there is:

#elif defined(freebsd4) || defined(openbsd4) || defined(dragonfly2) || \
    defined(darwin10)
config_require(mibII/kernel_sysctl)

If I change that "darwin10" to just be "darwin" everything builds fine. However, I am not 100% sure that is the correct fix.

I noticed in the master branch this code looks a little different:

config_arch_require(darwin10,  mibII/kernel_sysctl)
config_arch_require(darwin11,  mibII/kernel_sysctl)
config_arch_require(darwin12,  mibII/kernel_sysctl)
config_arch_require(darwin13,  mibII/kernel_sysctl)

...so it seems to try to expand use of kernel_sysctl to more darwin versions, but still not the "darwin20" that I am actually building under. I haven't tested if "master" works or not for me though.

So it seems like:

  • the existing code seems to be trying to make the kernel_sysctl use dependent on the exact version of MacOS one is building under
  • however neither master nor 5.9 seem to think darwin20 is in that set
  • yet it does seem to be required to make the project build

For reference, the reason that the symbols are used is because...

#elif (defined(NETSNMP_CAN_USE_SYSCTL) && defined(ICMPCTL_STATS))

... is true. ICMPCTL_STATS is defined in <netinet/icmp_var.h> (at least in MacOSX11.0.sdk). NETSNMP_CAN_USE_SYSCTL comes from the configure scripts (configure.d/config_os_misc4 to be precise):

configure:31574: checking if sysctl can read kernel information
configure:31617: gcc -o conftest -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -g -O2 -Udarwin20 -Ddarwin20=darwin20 -I/usr/local/opt/openssl@1.1/include  -flat_namespace -framework CoreFoundation -framework CoreServices -framework DiskArbitration -framework IOKit -L/usr/local/opt/openssl@1.1/lib  conftest.c  >&5
configure:31617: $? = 0
configure:31617: ./conftest
configure:31617: $? = 0
configure:31627: result: yes
mitchblank added a commit to mitchblank/homebrew-core that referenced this issue Dec 13, 2020
This was tricky but the main failure seems to be down to this issue
which I filed upstream: net-snmp/net-snmp#226
I'm not confident what the real fix is, but this workaround seems
to fix it.
BrewTestBot pushed a commit to Homebrew/homebrew-core that referenced this issue Dec 13, 2020
* net-snmp: fix build on Big Sur
  This was tricky but the main failure seems to be down to this issue
  which I filed upstream: net-snmp/net-snmp#226
  I'm not confident what the real fix is, but this workaround seems
  to fix it.
* net-snmp: update configure patch to version landed upstream

Closes #66832.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
@ryandesign
Copy link
Contributor

If I change that "darwin10" to just be "darwin" everything builds fine. However, I am not 100% sure that is the correct fix.

Ping.

I noticed in the master branch this code looks a little different:

The code in master is older, inexplicably. #310.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants