-
Notifications
You must be signed in to change notification settings - Fork 210
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
problems with libm detection for ceil() #72
Comments
bvanassche
added a commit
to bvanassche/net-snmp
that referenced
this issue
Feb 22, 2020
See also net-snmp#72. Reported-by: Stuart Henderson Fixes: 7497e2e ("check if libm is needed for ceil function") # v5.8.pre2
Please retest with the latest version of the master branch. |
Thanks Bart, it mostly helps but -lm is still present in LIBS from the exp() test in config_os_libs1.
I guess the simplest fix is to save/clear libs when running the ceil test? With this change it works for me:
|
bvanassche
added a commit
to bvanassche/net-snmp
that referenced
this issue
Feb 22, 2020
This change allows the ceil() test to add -lm to LNETSNMPLIBS. This patch is a follow-up for commit d63e35a ("configure: Add -lm to LNETSNMPLIBS if ceil() exists in libm"). See also net-snmp#72.
An additional fix has been checked in on the v5.8 and master branches. Please retest. |
Many thanks, that works nicely here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
7497e2e tries to detect if libm is required for ceil() (as used in snmplib/keytools.c if configure is called with --enable-blumenthal-aes), but there are some problems.
An earlier check for exp() - "diskIOLAx requires exp which may require -lm" in configure.d/config_os_libs1 leaves -lm in LIBS which is added to other checks including the one for ceil, so if exp requires -lm then you always get "checking for ceil without -lm... yes".
The ceil() check used is a link check for code calling "ceil((double)2.4)". Some compilers (at least I see it on clang 8.0.1 on OpenBSD) optimize away ceil with a fixed constant so you also always get "checking for ceil without -lm... yes" with such a compiler.
Even when it's detected as needed for ceil(), -lm is only added to LIBS not LNETSNMPLIBS so there's an unresolved symbol in the library. (Tools do pull in libm so work ok, but other software linking the library fails).
In my case -lm is already added to LIBS as needed from the abs() check and I can add the library linkage with
AC_CHECK_LIB(m, ceil, [LNETSNMPLIBS="$LNETSNMPLIBS -lm"])
in configure.d/config_os_libs2 but it probably needs something smarter in the more general case.The text was updated successfully, but these errors were encountered: