Bug 264749 - net/asterisk18 fails to build: missing header indirectly required through net-snmp
Summary: net/asterisk18 fails to build: missing header indirectly required through net...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-18 10:50 UTC by p5B2EA84B3
Modified: 2022-06-19 20:53 UTC (History)
1 user (show)

See Also:
madpilot: maintainer-feedback+


Attachments
poudriere build log file (801.78 KB, text/plain)
2022-06-18 10:50 UTC, p5B2EA84B3
no flags Details
poudriere build log net-snmp-5.9.1,1.log with IPV6=off compressed as requested (47.70 KB, application/x-xz)
2022-06-19 18:31 UTC, p5B2EA84B3
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description p5B2EA84B3 2022-06-18 10:50:52 UTC
Created attachment 234767 [details]
poudriere build log file

cc -o res_sorcery_memory_cache.o -c res_sorcery_memory_cache.c -MD -MT res_sorcery_memory_cache.o -MF .res_sorcery_memory_cache.o.d -MP -pthread -I/wrkdirs/usr/ports/net/asterisk18/work/asterisk-18.12.1/include -O2 -pipe  -I/usr/local/include/lua52 -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing   -I/usr/local/include/libxml2 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations  -fblocks  -isystem /usr/local/include -O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -DAST_MODULE=\"res_sorcery_memory_cache\" -DAST_MODULE_SELF_SYM=__internal_res_sorcery_memory_cache_self   -O2 -pipe  -I/usr/local/include/lua52 -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -Wno-unused-value -Wno-parentheses-equality 
1 error generated.
gmake[2]: *** [/wrkdirs/usr/ports/net/asterisk18/work/asterisk-18.12.1/Makefile.rules:165: snmp/agent.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: Leaving directory '/wrkdirs/usr/ports/net/asterisk18/work/asterisk-18.12.1/res'
gmake[1]: *** [Makefile:393: res] Error 2
gmake[1]: Leaving directory '/wrkdirs/usr/ports/net/asterisk18/work/asterisk-18.12.1'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/net/asterisk18
=>> Cleaning up wrkdir
===>  Cleaning for asterisk18-18.12.1
build of net/asterisk18 | asterisk18-18.12.1 ended at Sat Jun 18 12:43:09 CEST 2022
build time: 00:02:30
!!! build failure encountered !!!
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2022-06-18 11:13:41 UTC
Hi,
From your log the reported missing header file is 'net-snmp/library/snmpUDPIPv6Domain.h'

which is part of the net-mgmt/net-snmp port. ALso it is being included from another include that is part of net/net/snmp (/usr/local/include/net-snmp/session_api.h)

The missing include file is installed by the net-mgmt/net-snmp port only when the IPV6 option there is enabled, which is the default.

Could you check if you have the IPv6 option enabled there? If it is not enabling, does enabling it allow asterisk to build successfully?


There is not much the asterisk port can do to fix this and the ports system has no facility for a port to force required options in another port.
Comment 2 p5B2EA84B3 2022-06-18 15:44:23 UTC
Is IPv6 a mandatory prerequisite for running asterisk? 

If it is not, Asterisk should build without failing if net-im/net-snmp is configured without IPv6. There are infrastructures where disabled IPv6 is mandatory in local LAN.

Could you please report this upstream if Asterisk18 is designed/allowed to run in IPv4-only infrastructures?
Comment 3 Guido Falsi freebsd_committer freebsd_triage 2022-06-19 14:01:20 UTC
(In reply to p5B2EA84B3 from comment #2)

AFAIK no IPv6 is not required to build asterisk.

But the failure is not due to asterisk failing because net-snmp is compiled without IPv6 from what I can see.

It looks like net-snmp installs an include file, that requires another own include file which instead is installed only when IPv6 is preset, so this looks to me like an internal problem to net-snmp.


I will take a look to confirm this but you should also investigate yourself.


To summarize, my opinion at present, until I have time to investigate further, is that the issue is triggered by asterisk build but is really internal to net-snmp.
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2022-06-19 14:24:10 UTC
Hi zi,

I'm CCing you as the maintainer of net-snmp.

Looks like when net-snmp iss compiled with IPV6 disabled it still tries to include an include file only installed when building the port with IPv6 support.

this is the relevant part from the OP log:

cc -o snmp/agent.o -c snmp/agent.c -MD -MT snmp/agent.o -MF .snmp_agent.o.d -MP -pthread -I/wrkdirs/usr/ports/net/asterisk18/work/asterisk-18.12.1/include -O2 -pipe  -I/usr/local/include/lua52 -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing   -I/usr/local/include/libxml2 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations  -fblocks  -isystem /usr/local/include -O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -DAST_MODULE=\"res_snmp\" -DAST_MODULE_SELF_SYM=__internal_res_snmp_self  -I/usr/local/include -fPIC -O2 -pipe  -I/usr/local/include/lua52 -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -Wno-unused-value -Wno-parentheses-equality 
In file included from snmp/agent.c:63:
In file included from /usr/local/include/net-snmp/net-snmp-includes.h:24:
In file included from /usr/local/include/net-snmp/definitions.h:22:
In file included from /usr/local/include/net-snmp/types.h:425:
In file included from /usr/local/include/net-snmp/library/snmp_api.h:33:
In file included from /usr/local/include/net-snmp/varbind_api.h:102:
In file included from /usr/local/include/net-snmp/library/snmp_client.h:33:
/usr/local/include/net-snmp/session_api.h:317:10: fatal error: 'net-snmp/library/snmpUDPIPv6Domain.h' file not found
#include <net-snmp/library/snmpUDPIPv6Domain.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Looks like even if IPv6 is disabled NETSNMP_TRANSPORT_UDPIPV6_DOMAIN is still defined in the installed includes, causing this error.

I could not find an toggle related to this in asterisk which is only including some higher level includes from net-snmp. This looks like an internal define.

Could you give me feedback?

Thanks in advance!



To OP:

could you also attach the latest build log for net-snmp with IPv6 disabled? Could be useful to better diagnosse the issue.
Comment 5 Ryan Steinmetz freebsd_committer freebsd_triage 2022-06-19 15:34:21 UTC
As a test, try editing net-mgmt/net-snmp/pkg-plist and removing the %%WITH_IPV6%% bit from the following lines:

%%WITH_IPV6%%include/net-snmp/library/snmpTCPIPv6Domain.h
%%WITH_IPV6%%include/net-snmp/library/snmpUDPIPv6Domain.h
%%WITH_IPV6%%include/net-snmp/library/snmpIPv6BaseDomain.h
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2022-06-19 17:55:11 UTC
(In reply to Ryan Steinmetz from comment #5)

Thanks for taking a look.

I reproduced the issue locally, and uncommenting the lines you indicate asterisk is able to build successfully.

I will try to run it, but I'm not using SNMP here, so I can't properly test it at runtime.
Comment 7 p5B2EA84B3 2022-06-19 18:31:57 UTC
Created attachment 234791 [details]
poudriere build log net-snmp-5.9.1,1.log with IPV6=off compressed as requested
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-06-19 18:55:03 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=39602e0db1b98e0aecb29497466e55b325d1cfdf

commit 39602e0db1b98e0aecb29497466e55b325d1cfdf
Author:     Ryan Steinmetz <zi@FreeBSD.org>
AuthorDate: 2022-06-19 18:52:37 +0000
Commit:     Ryan Steinmetz <zi@FreeBSD.org>
CommitDate: 2022-06-19 18:54:25 +0000

    net-mgmt/net-snmp: Fix asterisk build

    Always install IPv6 headers, regardless of IPv6 OPTION
    PR:             264749

 net-mgmt/net-snmp/Makefile  | 1 +
 net-mgmt/net-snmp/pkg-plist | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
Comment 9 Guido Falsi freebsd_committer freebsd_triage 2022-06-19 19:24:23 UTC
(In reply to commit-hook from comment #8)

@zi: Thanks a lot!

p5B2EA84B3@t-online.de: could you verify asterisk now builds fine for you and in that case close this as resolved?
Comment 10 p5B2EA84B3 2022-06-19 20:52:45 UTC
Thank you both, zi and Guido!

asterisk now builds fine.