[Home]

Summary:ASTERISK-29709: res_snmp: Not build on recent Debian distributions.
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2021-10-28 07:01:25Date Closed:2021-11-04 10:49:26
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_snmp
Versions:16.21.1 18.7.1 Frequency of
Occurrence
Related
Issues:
Environment:Clang 13 on Ubuntu 21.10Attachments:( 0) clang_res_snmp.patch
Description:The automatic build tools (autotools) of Asterisk look for the headers and libraries of the SNMP Agent via its developer tool {{net-snmp-config}}. However, at least in Ubuntu 20.10, that tool explains how the SNMP Agent was build, not how it should be used to build on it. This can be seen after running the script {{./configure}} in the file {{makeopts}}. In other words, instead of giving just the library name(s), {{net-snmp-config}} provides a long list of include and library statements.

I tested not with GCC but with Clang. Because the build tools of Asterisk include a small test program to run, the compiler/linker has to those long lists already to determine whether the Asterisk module  {{res_snmp}} can be build. However, to compile that test program, Clang 13 requires the additional package {{llvm-13-linker-tools}}. In other works, only with that additional package, {{res_snmp}} is selectable via {{make menuselect}}.

Even then, Clang warns about the optimization flag {{-ffat-lto-objects}} because it is not supported in Clang. If the developer mode was configured, that warning turns into an error, and the build aborts.

Long story short, all {{*-config}} tools are deprecated and should be replaced with the tool {{pkg-config}}. Since Debian Bullseye and Ubuntu 21.04, the developer package [libsnmp-dev|https://packages.ubuntu.com/libsnmp-dev] contains the required {{netsnmp-agent.pc}} file for that. Therefore, the solution is to check via {{pkg-config}} first. Only if that fails, the old tool {{net-snmp-config}} should be queried.

The attached patch implements that approach. After applying the patch, execute the script {{./bootstrap.sh}}.

*Note 1*:
The script {{./configure}} queries several other, deprecated {{\*-config}} tools, namely for [neon|https://notroj.github.io/neon/] (used by the extended modules {{res_calendar_*}}) and XML2 (used by the extended module {{res_calendar_caldav}}). Because XML2 is even an essential library for {{make menuselect}}, someone should look into adding {{pkg-config}} for those; both support {{.pc}} files for ages.

*Note 2*:
I am not sure why {{net-snmp-config}} gives the headers and libraries with which it was build rather than those which are required to build on. I am not so much into those config tools but would have expected both give the same results. This should be discussed with the (Debian) maintainer of that package.
Comments:By: Asterisk Team (asteriskteam) 2021-10-28 07:01:27.284-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Alexander Traud (traud) 2021-10-28 08:07:12.400-0500

About Note 1:
Two more legacy tools exist in the script {{./configure}} (named not with a dash but an underscore): {{mysql_config}} and {{pg_config}}. In Debian/Ubuntu, both developer packages offer .pc files for years.

By: Friendly Automation (friendly-automation) 2021-11-04 10:49:27.020-0500

Change 16649 merged by Friendly Automation:
res_snmp: As build tool, prefer pkg-config over net-snmp-config.

[https://gerrit.asterisk.org/c/asterisk/+/16649|https://gerrit.asterisk.org/c/asterisk/+/16649]

By: Friendly Automation (friendly-automation) 2021-11-04 10:49:55.963-0500

Change 16651 merged by Friendly Automation:
res_snmp: As build tool, prefer pkg-config over net-snmp-config.

[https://gerrit.asterisk.org/c/asterisk/+/16651|https://gerrit.asterisk.org/c/asterisk/+/16651]

By: Friendly Automation (friendly-automation) 2021-11-04 10:50:00.054-0500

Change 16650 merged by Friendly Automation:
res_snmp: As build tool, prefer pkg-config over net-snmp-config.

[https://gerrit.asterisk.org/c/asterisk/+/16650|https://gerrit.asterisk.org/c/asterisk/+/16650]

By: Friendly Automation (friendly-automation) 2021-11-04 17:04:44.308-0500

Change 16638 merged by Kevin Harwell:
res_snmp: As build tool, prefer pkg-config over net-snmp-config.

[https://gerrit.asterisk.org/c/asterisk/+/16638|https://gerrit.asterisk.org/c/asterisk/+/16638]