bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] macOS: mpfrsqrt check fails on gawk-4.2-stable and master


From: Andrew J. Schorr
Subject: Re: [bug-gawk] macOS: mpfrsqrt check fails on gawk-4.2-stable and master branches
Date: Thu, 8 Feb 2018 08:26:45 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Feb 08, 2018 at 01:50:24AM -0700, address@hidden wrote:
> address@hidden wrote:
> 
> > The flows in mpfr.c and extension/intdiv.c for the MPFR cases are
> > completely different.  The first uses mpfr_get_z and the second
> > uses mpz_tdiv_qr.
> 
> No, I'm wrong. Both eventually get to mpz_tdiv_qr.

Phew.

> > Andy - did you write the extension?

Yes. I am guilty. I copied the logic from intdiv0 to demonstrate the
new MPFR support in the API.

> > I also have to wonder if we're up against compiler issues. Linux
> > uses GCC to comple MPFR and GMP, and on Mac OS X it's clang.
> 
> I am still wondering about this.

My current hope is that it's a dynamic linking issue. I don't think the
intdiv extension needs to link in mpfr and libm, since main gawk has already
linked these in. I just sent a patch to Hermann to explore this possibility.

diff --git a/extension/Makefile.am b/extension/Makefile.am
index df55b98..b590a5b 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -77,7 +77,7 @@ inplace_la_LIBADD     = $(MY_LIBS)
 # Solaris in addition wants the math library.
 intdiv_la_SOURCES     = intdiv.c
 intdiv_la_LDFLAGS     = $(MY_MODULE_FLAGS)
-intdiv_la_LIBADD      = $(MY_LIBS) $(LIBMPFR) -lm
+intdiv_la_LIBADD      = $(MY_LIBS)
 
 ordchr_la_SOURCES     = ordchr.c
 ordchr_la_LDFLAGS     = $(MY_MODULE_FLAGS)

On my CentOS 7.4 system, this patch works OK. Before the patch:
bash-4.2$ ldd extension/.libs/intdiv.so
        linux-vdso.so.1 =>  (0x00007fffdd9e8000)
        libmpfr.so.4 => /lib64/libmpfr.so.4 (0x00007f9f07ca4000)
        libgmp.so.10 => /lib64/libgmp.so.10 (0x00007f9f07a2c000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f9f07729000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f9f07366000)
        /lib64/ld-linux-x86-64.so.2 (0x0000560603fa6000)

And after:

bash-4.2$ ldd extension/.libs/intdiv.so
        linux-vdso.so.1 =>  (0x00007ffc82ffc000)
        libm.so.6 => /lib64/libm.so.6 (0x00007ff18441b000)
        libc.so.6 => /lib64/libc.so.6 (0x00007ff184058000)
        /lib64/ld-linux-x86-64.so.2 (0x000055c4fd853000)

Let's see about MacOS.

-Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]