GNU bug report logs - #55294
Configure failure on Solaris 11.4

Previous Next

Package: emacs;

Reported by: Steve Downey <sdowney <at> gmail.com>

Date: Fri, 6 May 2022 20:34:01 UTC

Severity: normal

Tags: moreinfo

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55294 in the body.
You can then email your comments to 55294 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Fri, 06 May 2022 20:34:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steve Downey <sdowney <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 06 May 2022 20:34:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Steve Downey <sdowney <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Configure failure on Solaris 11.4
Date: Fri, 6 May 2022 15:58:39 -0400
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Sat, 07 May 2022 05:41:02 GMT) Full text and rfc822 format available.

Message #8 received at 55294 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Steve Downey <sdowney <at> gmail.com>
Cc: 55294 <at> debbugs.gnu.org
Subject: Re: bug#55294: Configure failure on Solaris 11.4
Date: Sat, 07 May 2022 08:40:15 +0300
> From: Steve Downey <sdowney <at> 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.




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 07 May 2022 10:21:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Mon, 09 May 2022 19:09:01 GMT) Full text and rfc822 format available.

Message #13 received at 55294 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Steve Downey <sdowney <at> gmail.com>
Cc: 55294 <at> debbugs.gnu.org
Subject: Re: Configure failure on Solaris 11.4
Date: Mon, 9 May 2022 12:07:51 -0700
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Mon, 09 May 2022 19:23:02 GMT) Full text and rfc822 format available.

Message #16 received at 55294 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 55294 <at> debbugs.gnu.org, sdowney <at> gmail.com
Subject: Re: bug#55294: Configure failure on Solaris 11.4
Date: Mon, 09 May 2022 22:21:50 +0300
> Resent-From: Paul Eggert <eggert <at> cs.ucla.edu>
> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
> Resent-CC: bug-gnu-emacs <at> gnu.org
> Resent-Sender: help-debbugs <at> gnu.org
> Cc: 55294 <at> debbugs.gnu.org
> Date: Mon, 9 May 2022 12:07:51 -0700
> From: Paul Eggert <eggert <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Mon, 09 May 2022 19:35:02 GMT) Full text and rfc822 format available.

Message #19 received at 55294 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55294 <at> debbugs.gnu.org, sdowney <at> gmail.com
Subject: Re: bug#55294: Configure failure on Solaris 11.4
Date: Mon, 9 May 2022 12:34:01 -0700
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Tue, 10 May 2022 00:17:02 GMT) Full text and rfc822 format available.

Message #22 received at 55294 <at> debbugs.gnu.org (full text, mbox):

From: Steve Downey <sdowney <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 55294 <at> debbugs.gnu.org
Subject: Re: Configure failure on Solaris 11.4
Date: Mon, 9 May 2022 20:15:56 -0400
[Message part 1 (text/plain, inline)]
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 <at> 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.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Tue, 10 May 2022 02:36:01 GMT) Full text and rfc822 format available.

Message #25 received at 55294 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Steve Downey <sdowney <at> gmail.com>
Cc: eggert <at> cs.ucla.edu, 55294 <at> debbugs.gnu.org
Subject: Re: bug#55294: Configure failure on Solaris 11.4
Date: Tue, 10 May 2022 05:35:44 +0300
> Cc: 55294 <at> debbugs.gnu.org
> From: Steve Downey <sdowney <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Tue, 10 May 2022 04:47:02 GMT) Full text and rfc822 format available.

Message #28 received at 55294 <at> debbugs.gnu.org (full text, mbox):

From: Steve Downey <sdowney <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: eggert <at> cs.ucla.edu, 55294 <at> debbugs.gnu.org
Subject: Re: bug#55294: Configure failure on Solaris 11.4
Date: Tue, 10 May 2022 00:46:15 -0400
[Message part 1 (text/plain, inline)]
On Mon, May 9, 2022 at 10:35 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Cc: 55294 <at> debbugs.gnu.org
> > From: Steve Downey <sdowney <at> 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.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55294; Package emacs. (Tue, 10 May 2022 12:08:01 GMT) Full text and rfc822 format available.

Message #31 received at 55294 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Steve Downey <sdowney <at> gmail.com>
Cc: eggert <at> cs.ucla.edu, 55294 <at> debbugs.gnu.org
Subject: Re: bug#55294: Configure failure on Solaris 11.4
Date: Tue, 10 May 2022 15:07:23 +0300
> From: Steve Downey <sdowney <at> gmail.com>
> Date: Tue, 10 May 2022 00:46:15 -0400
> Cc: eggert <at> cs.ucla.edu, 55294 <at> 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.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 10 May 2022 21:50:02 GMT) Full text and rfc822 format available.

Notification sent to Steve Downey <sdowney <at> gmail.com>:
bug acknowledged by developer. (Tue, 10 May 2022 21:50:02 GMT) Full text and rfc822 format available.

Message #36 received at 55294-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55294-done <at> debbugs.gnu.org, Steve Downey <sdowney <at> gmail.com>
Subject: Re: bug#55294: Configure failure on Solaris 11.4
Date: Tue, 10 May 2022 14:49:30 -0700
[Message part 1 (text/plain, inline)]
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.
[0001-Port-libm-configure-time-test-to-Solaris-11.4.patch (text/x-patch, attachment)]
[0002-src-floatfns.c-Update-comment.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 08 Jun 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 294 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.