* bug#55294: Configure failure on Solaris 11.4 @ 2022-05-06 19:58 Steve Downey 2022-05-07 5:40 ` Eli Zaretskii 2022-05-09 19:07 ` Paul Eggert 0 siblings, 2 replies; 10+ messages in thread From: Steve Downey @ 2022-05-06 19:58 UTC (permalink / raw) To: 55294 [-- Attachment #1: Type: text/plain, Size: 321 bytes --] On solaris 11.4, the system libc has a definition of sqrt leading configure to believe that linking libm is unnecessary. Applying a patch locally to change AC_SEARCH_LIBS([sqrt], [m]) to AC_SEARCH_LIBS([atan], [m]) fixes the problem. atan was picked at random from the symbols that couldn't be found in building temacs. [-- Attachment #2: Type: text/html, Size: 568 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-06 19:58 bug#55294: Configure failure on Solaris 11.4 Steve Downey @ 2022-05-07 5:40 ` Eli Zaretskii 2022-05-09 19:07 ` Paul Eggert 1 sibling, 0 replies; 10+ messages in thread From: Eli Zaretskii @ 2022-05-07 5:40 UTC (permalink / raw) To: Steve Downey; +Cc: 55294 > From: Steve Downey <sdowney@gmail.com> > Date: Fri, 6 May 2022 15:58:39 -0400 > > On solaris 11.4, the system libc has a definition of sqrt leading configure to believe that linking libm is > unnecessary. Can you tell the details, please? What is that definition of sqrt, and what do you see in config.log when it is tested? > Applying a patch locally to change > AC_SEARCH_LIBS([sqrt], [m]) to > AC_SEARCH_LIBS([atan], [m]) > fixes the problem. > > atan was picked at random from the symbols that couldn't be found in building temacs. This is fragile, because we could have the same problem with atan, in the future or on some other platform, if not here and now. I think we should understand better why using sqrt leads to the wrong conclusion, and modify configure to avoid that. Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-06 19:58 bug#55294: Configure failure on Solaris 11.4 Steve Downey 2022-05-07 5:40 ` Eli Zaretskii @ 2022-05-09 19:07 ` Paul Eggert 2022-05-09 19:21 ` Eli Zaretskii 2022-05-10 0:15 ` Steve Downey 1 sibling, 2 replies; 10+ messages in thread From: Paul Eggert @ 2022-05-09 19:07 UTC (permalink / raw) To: Steve Downey; +Cc: 55294 Thanks for the bug report. The patch looks safe, since Emacs calls atan as well as sqrt. And it looks like an improvement, since I can imagine all sorts of reasons why sqrt would not need libm whereas atan would, starting with the fact that typical hardware nowadays has sqrt instructions but not atan instructions. (The 'configure' test itself relies on undefined behavior, so it's not strictly portable anyway.) Although it would be helpful to know how to reproduce the problem (which compiler? how configured? etc.) and which symbols were not found in temacs on Solaris 11.4, we don't need to know that to install the patch. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-09 19:07 ` Paul Eggert @ 2022-05-09 19:21 ` Eli Zaretskii 2022-05-09 19:34 ` Paul Eggert 2022-05-10 0:15 ` Steve Downey 1 sibling, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2022-05-09 19:21 UTC (permalink / raw) To: Paul Eggert; +Cc: 55294, sdowney > Resent-From: Paul Eggert <eggert@cs.ucla.edu> > Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> > Resent-CC: bug-gnu-emacs@gnu.org > Resent-Sender: help-debbugs@gnu.org > Cc: 55294@debbugs.gnu.org > Date: Mon, 9 May 2022 12:07:51 -0700 > From: Paul Eggert <eggert@cs.ucla.edu> > > Thanks for the bug report. The patch looks safe, since Emacs calls atan > as well as sqrt. And it looks like an improvement, since I can imagine > all sorts of reasons why sqrt would not need libm whereas atan would, > starting with the fact that typical hardware nowadays has sqrt > instructions but not atan instructions. (The 'configure' test itself > relies on undefined behavior, so it's not strictly portable anyway.) > > Although it would be helpful to know how to reproduce the problem (which > compiler? how configured? etc.) and which symbols were not found in > temacs on Solaris 11.4, we don't need to know that to install the patch. As I explained earlier, I'd like to understand it better, and would not want to blindly move to another function. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-09 19:21 ` Eli Zaretskii @ 2022-05-09 19:34 ` Paul Eggert 0 siblings, 0 replies; 10+ messages in thread From: Paul Eggert @ 2022-05-09 19:34 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 55294, sdowney On 5/9/22 12:21, Eli Zaretskii wrote: > As I explained earlier, I'd like to understand it better, and would > not want to blindly move to another function. Understood, and it would be nice to know that. But it's even nicer to have an Emacs that works, and we know the proposed simple change does that on Solaris 11.4 whereas it is extremely implausible that it would hurt any other platform. It's fine to wait for more information, but if we don't get it let's not turn down this gift horse in the mouth. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-09 19:07 ` Paul Eggert 2022-05-09 19:21 ` Eli Zaretskii @ 2022-05-10 0:15 ` Steve Downey 2022-05-10 2:35 ` Eli Zaretskii 1 sibling, 1 reply; 10+ messages in thread From: Steve Downey @ 2022-05-10 0:15 UTC (permalink / raw) To: Paul Eggert; +Cc: 55294 [-- Attachment #1: Type: text/plain, Size: 2575 bytes --] I don't have the full configure logs at hand. The build was with the Sun Studio suite 12.6, and it builds successfully on Solaris 11.3, and fails linking on 11.4. Failure was: CCLD temacs Undefined first referenced symbol in file cos floatfns.o exp floatfns.o log floatfns.o pow xfns.o sin floatfns.o tan floatfns.o acos floatfns.o asin floatfns.o atan floatfns.o ceil floatfns.o fmod floatfns.o powf pdumper.o atan2 floatfns.o floor xterm.o ilogb floatfns.o log10 xdisp.o lround hbfont.o scalbn floatfns.o ld: fatal: symbol referencing errors In 11.4, sqrt is defined in libc.so as an absolute symbol, so the test for if -lm is necessary succeeds without it. I haven't disassembled the new libc, but I suspect that you're right and they have a sqrt that is fast enough either depends on a sqrt instruction or is otherwise "simple" for some value of simple. Was able to reproduce the build failure with SS12.4 on 11.4 as well. This is the actual patch we're using: --- emacs-27.2.orig/configure.ac +++ emacs-27.2/configure.ac @@ -1634,14 +1634,14 @@ AC_DEFUN([AC_TYPE_SIZE_T]) # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them. AC_DEFUN([AC_TYPE_UID_T]) -# sqrt and other floating-point functions such as fmod and frexp +# atan and other floating-point functions such as fmod and frexp # are found in -lm on many systems. OLD_LIBS=$LIBS -AC_SEARCH_LIBS([sqrt], [m]) +AC_SEARCH_LIBS([atan], [m]) if test "X$LIBS" = "X$OLD_LIBS"; then LIB_MATH= else - LIB_MATH=$ac_cv_search_sqrt + LIB_MATH=$ac_cv_search_atan fi LIBS=$OLD_LIBS Reading elsethread, I totally understand Eli Zaretskii's concern about this being fragile, but as near as I can tell this is still the unfortunate state of the art in figuring out if libm is needed using autoconf, although testing with trig functions does seem to be the mode these days. On Mon, May 9, 2022 at 3:07 PM Paul Eggert <eggert@cs.ucla.edu> wrote: > Thanks for the bug report. The patch looks safe, since Emacs calls atan > as well as sqrt. And it looks like an improvement, since I can imagine > all sorts of reasons why sqrt would not need libm whereas atan would, > starting with the fact that typical hardware nowadays has sqrt > instructions but not atan instructions. (The 'configure' test itself > relies on undefined behavior, so it's not strictly portable anyway.) > > Although it would be helpful to know how to reproduce the problem (which > compiler? how configured? etc.) and which symbols were not found in > temacs on Solaris 11.4, we don't need to know that to install the patch. > [-- Attachment #2: Type: text/html, Size: 4267 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-10 0:15 ` Steve Downey @ 2022-05-10 2:35 ` Eli Zaretskii 2022-05-10 4:46 ` Steve Downey 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2022-05-10 2:35 UTC (permalink / raw) To: Steve Downey; +Cc: eggert, 55294 > Cc: 55294@debbugs.gnu.org > From: Steve Downey <sdowney@gmail.com> > Date: Mon, 9 May 2022 20:15:56 -0400 > > In 11.4, sqrt is defined in libc.so as an absolute symbol, so the test for if -lm is necessary succeeds without > it. I haven't disassembled the new libc, but I suspect that you're right and they have a sqrt that is fast enough > either depends on a sqrt instruction or is otherwise "simple" for some value of simple. So you are saying that sqrt was actually in libc, but the rest of math functions are in libm, is that right? If so, perhaps to make this test more future-proof, we should try several functions, not just one? ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-10 2:35 ` Eli Zaretskii @ 2022-05-10 4:46 ` Steve Downey 2022-05-10 12:07 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Steve Downey @ 2022-05-10 4:46 UTC (permalink / raw) To: Eli Zaretskii; +Cc: eggert, 55294 [-- Attachment #1: Type: text/plain, Size: 1075 bytes --] On Mon, May 9, 2022 at 10:35 PM Eli Zaretskii <eliz@gnu.org> wrote: > > Cc: 55294@debbugs.gnu.org > > From: Steve Downey <sdowney@gmail.com> > > Date: Mon, 9 May 2022 20:15:56 -0400 > > > > In 11.4, sqrt is defined in libc.so as an absolute symbol, so the test > for if -lm is necessary succeeds without > > it. I haven't disassembled the new libc, but I suspect that you're right > and they have a sqrt that is fast enough > > either depends on a sqrt instruction or is otherwise "simple" for some > value of simple. > > So you are saying that sqrt was actually in libc, but the rest of math > functions are in libm, is that right? > > Exactly. I also suspect that this will not be the only package broken, because lots of people cargo cult this sort of autoconf check from GNU packages. At least to the extent that people still use autotools. If so, perhaps to make this test more future-proof, we should try > several functions, not just one? > And gate linking libm on any of them being unavailable. But writing that would mean having to resuscitate my M4 knowledge. [-- Attachment #2: Type: text/html, Size: 1785 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-10 4:46 ` Steve Downey @ 2022-05-10 12:07 ` Eli Zaretskii 2022-05-10 21:49 ` Paul Eggert 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2022-05-10 12:07 UTC (permalink / raw) To: Steve Downey; +Cc: eggert, 55294 > From: Steve Downey <sdowney@gmail.com> > Date: Tue, 10 May 2022 00:46:15 -0400 > Cc: eggert@cs.ucla.edu, 55294@debbugs.gnu.org > > If so, perhaps to make this test more future-proof, we should try > several functions, not just one? > > And gate linking libm on any of them being unavailable. But writing that would mean having to resuscitate my > M4 knowledge. I think it's easy enough, and I'm sure Paul will be able to do that. In the improbable case that he doesn't, I will. Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#55294: Configure failure on Solaris 11.4 2022-05-10 12:07 ` Eli Zaretskii @ 2022-05-10 21:49 ` Paul Eggert 0 siblings, 0 replies; 10+ messages in thread From: Paul Eggert @ 2022-05-10 21:49 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 55294-done, Steve Downey [-- Attachment #1: Type: text/plain, Size: 166 bytes --] On 5/10/22 05:07, Eli Zaretskii wrote: > I think it's easy enough, and I'm sure Paul will be able to do that. Sure, I installed the attached. Closing the bug report. [-- Attachment #2: 0001-Port-libm-configure-time-test-to-Solaris-11.4.patch --] [-- Type: text/x-patch, Size: 2334 bytes --] From 203ffc68468abaccfed7e8ee630d9aa143ce5dbf Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@cs.ucla.edu> Date: Tue, 10 May 2022 14:44:35 -0700 Subject: [PATCH 1/2] Port libm configure-time test to Solaris 11.4 * configure.ac (LIB_MATH): Check all the math.h functions that Emacs uses, not just sqrt (Bug#55294). --- configure.ac | 67 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 484ce980a5..1ba4448d1e 100644 --- a/configure.ac +++ b/configure.ac @@ -1617,16 +1617,63 @@ AC_DEFUN # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them. AC_DEFUN([AC_TYPE_UID_T]) -# sqrt and other floating-point functions such as fmod and frexp -# are found in -lm on many systems. -OLD_LIBS=$LIBS -AC_SEARCH_LIBS([sqrt], [m]) -if test "X$LIBS" = "X$OLD_LIBS"; then - LIB_MATH= -else - LIB_MATH=$ac_cv_search_sqrt -fi -LIBS=$OLD_LIBS +# Check for all math.h functions that Emacs uses; on some platforms, +# -lm is needed for some of these functions. +AC_CACHE_CHECK([for math library], + [emacs_cv_lib_math], + [OLD_LIBS=$LIBS + AC_LINK_IFELSE( + [AC_LANG_SOURCE([[ + #include <math.h> + int + main (int argc, char **argv) + { + double d = argc; + float f = argc; + int i = argc; + long l = argc; + d = acos (d); + d = asin (d); + d = atan (d); + d = atan2 (d, d); + d = ceil (d); + d = copysign (d, d); + d = cos (d); + d = exp (d); + d = fabs (d); + d = floor (d); + d = fmod (d, d); + d = frexp (d, &i); + d = ldexp (d, i); + d = log (d); + d = log2 (d); + d = log10 (d); + d = pow (d, d); + d = rint (d); + d = scalbn (d, l); + d = sin (d); + d = sqrt (d); + d = tan (d); + d = trunc (d); + f = fabsf (f); + f = powf (f, f); + i = ilogb (d); + i = signbit (d); + l = lrint (d); + l = lround (d); + return d == f && i == l; + } + ]])], + [emacs_cv_lib_math='none required'], + [LIBS="-lm $LIBS" + AC_LINK_IFELSE([], + [emacs_cv_lib_math=-lm], + [AC_MSG_ERROR([Math library (-lm) not found])])]) + LIBS=$OLD_LIBS]) +case $emacs_cv_lib_math in + -*) LIB_MATH=$emacs_cv_lib_math;; + *) LIB_MATH=;; +esac dnl Current possibilities handled by sed (aix4-2 -> aix, dnl gnu-linux -> gnu/linux, etc.): -- 2.35.3 [-- Attachment #3: 0002-src-floatfns.c-Update-comment.patch --] [-- Type: text/x-patch, Size: 2031 bytes --] From 4433df3b2015b3b1acd9d24bf7169c010fb51a05 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@cs.ucla.edu> Date: Tue, 10 May 2022 14:47:09 -0700 Subject: [PATCH 2/2] * src/floatfns.c: Update comment. --- src/floatfns.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/floatfns.c b/src/floatfns.c index f2b3b13acd..293184c70f 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -29,14 +29,20 @@ Copyright (C) 1988, 1993-1994, 1999, 2001-2022 Free Software Foundation, C99 and C11 require the following math.h functions in addition to the C89 functions. Of these, Emacs currently exports only the - starred ones to Lisp, since we haven't found a use for the others: - acosh, atanh, cbrt, *copysign, erf, erfc, exp2, expm1, fdim, fma, - fmax, fmin, fpclassify, hypot, ilogb, isfinite, isgreater, - isgreaterequal, isinf, isless, islessequal, islessgreater, *isnan, - isnormal, isunordered, lgamma, log1p, *log2 [via (log X 2)], *logb - (approximately), lrint/llrint, lround/llround, nan, nearbyint, - nextafter, nexttoward, remainder, remquo, *rint, round, scalbln, - scalbn, signbit, tgamma, *trunc. + starred ones to Lisp, since we haven't found a use for the others. + Also, it uses the ones marked "+" internally: + acosh, atanh, cbrt, copysign (implemented by signbit), erf, erfc, + exp2, expm1, fdim, fma, fmax, fmin, fpclassify, hypot, +ilogb, + isfinite, isgreater, isgreaterequal, isinf, isless, islessequal, + islessgreater, *isnan, isnormal, isunordered, lgamma, log1p, *log2 + [via (log X 2)], logb (approximately; implemented by frexp), + +lrint/llrint, +lround/llround, nan, nearbyint, nextafter, + nexttoward, remainder, remquo, *rint, round, scalbln, +scalbn, + +signbit, tgamma, *trunc. + + The C standard also requires functions for float and long double + that are not listed above. Of these functions, Emacs uses only the + following internally: fabsf, powf, sprintf. */ #include <config.h> -- 2.35.3 ^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-05-10 21:49 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-05-06 19:58 bug#55294: Configure failure on Solaris 11.4 Steve Downey 2022-05-07 5:40 ` Eli Zaretskii 2022-05-09 19:07 ` Paul Eggert 2022-05-09 19:21 ` Eli Zaretskii 2022-05-09 19:34 ` Paul Eggert 2022-05-10 0:15 ` Steve Downey 2022-05-10 2:35 ` Eli Zaretskii 2022-05-10 4:46 ` Steve Downey 2022-05-10 12:07 ` Eli Zaretskii 2022-05-10 21:49 ` Paul Eggert
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.