Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

One man's constant is another man's variable. -- A. J. Perlis


devel / comp.lang.fortran / Re: MPFR binding for Fortran

SubjectAuthor
* MPFR binding for FortranThomas Koenig
`* Re: MPFR binding for Fortranfeanor
 `* Re: MPFR binding for FortranThomas Koenig
  `* Re: MPFR binding for FortranThomas Koenig
   `* Re: MPFR binding for FortranThomas Koenig
    `* Re: MPFR binding for Fortranfeanor
     `* Re: MPFR binding for FortranThomas Koenig
      `* Re: MPFR binding for FortranJRR
       `- Re: MPFR binding for FortranThomas Koenig

1
MPFR binding for Fortran

<tb4is3$mt2$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2591&group=comp.lang.fortran#2591

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: MPFR binding for Fortran
Date: Mon, 18 Jul 2022 21:21:07 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tb4is3$mt2$1@newsreader4.netcologne.de>
Injection-Date: Mon, 18 Jul 2022 21:21:07 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd6:2699:0:7285:c2ff:fe6c:992d";
logging-data="23458"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 18 Jul 2022 21:21 UTC

Hi,

I've been working on a little pet project of mine, an MPFR binding
for Fortran. I have now released a very first version github,
at https://github.com/tkoenig1/FMPFR .

So, if anybody wants to try out some arbitrary-precision floating
point calculations in Fortran, give it a spin.

Suggestions for improvements are also welcome.

A little code sample:

program memain
use fmpfr_oper
implicit none
type (fmpfr), dimension(:), allocatable :: a
call set_default_prec (128)
allocate (a(2))
a(1) = fmpfr("1.3")
a(2) = a(1) + 2
print *,a
print *,sin(a)
end program memain

Re: MPFR binding for Fortran

<ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2597&group=comp.lang.fortran#2597

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:1345:b0:31e:b991:ac1e with SMTP id w5-20020a05622a134500b0031eb991ac1emr25358513qtk.279.1658234756988;
Tue, 19 Jul 2022 05:45:56 -0700 (PDT)
X-Received: by 2002:a5b:487:0:b0:664:3c15:7e19 with SMTP id
n7-20020a5b0487000000b006643c157e19mr30723665ybp.105.1658234756759; Tue, 19
Jul 2022 05:45:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 19 Jul 2022 05:45:56 -0700 (PDT)
In-Reply-To: <tb4is3$mt2$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:cb:ff10:7c4f:e0af:27cd:1777:cb38;
posting-account=nzBwnQoAAACNPvrl2_g4iY27wcwaeeNX
NNTP-Posting-Host: 2003:cb:ff10:7c4f:e0af:27cd:1777:cb38
References: <tb4is3$mt2$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>
Subject: Re: MPFR binding for Fortran
From: juergen.reuter@desy.de (feanor)
Injection-Date: Tue, 19 Jul 2022 12:45:56 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2603
 by: feanor - Tue, 19 Jul 2022 12:45 UTC

Thomas Koenig schrieb am Montag, 18. Juli 2022 um 23:21:11 UTC+2:
> Hi,
>
> I've been working on a little pet project of mine, an MPFR binding
> for Fortran. I have now released a very first version github,
> at https://github.com/tkoenig1/FMPFR .
>
> So, if anybody wants to try out some arbitrary-precision floating
> point calculations in Fortran, give it a spin.

Nice. Thanks for the effort. I tried it out immediately. I removed the symlinks for the autotools files and replaced them with copies
from my own project. Then I compiled/link your example program as
gfortran foo.f90 -L/home/reuter/local/lib -lfmpfr -I../src -lmpfr
But both on Ubuntu 18.04 and on Apple Darwin x86_64 I got
NaN NaN
NaN NaN
The dependencies look ok to me;
$ ldd a.out
linux-vdso.so.1 (0x00007fff175d5000)
libmpfr.so.6 => /usr/lib/x86_64-linux-gnu/libmpfr.so.6 (0x00007f522538e000)
libgfortran.so.4 => /usr/lib/x86_64-linux-gnu/libgfortran.so.4 (0x00007f5224faf000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5224bbe000)
libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f522493d000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5225819000)
libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f52246fd000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f522435f000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5224147000)

Any idea what goes wrong here?
Cheers,
JRR

Re: MPFR binding for Fortran

<tb6oth$57f$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2598&group=comp.lang.fortran#2598

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: MPFR binding for Fortran
Date: Tue, 19 Jul 2022 17:16:33 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tb6oth$57f$1@newsreader4.netcologne.de>
References: <tb4is3$mt2$1@newsreader4.netcologne.de>
<ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>
Injection-Date: Tue, 19 Jul 2022 17:16:33 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd6:2699:0:7285:c2ff:fe6c:992d";
logging-data="5359"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 19 Jul 2022 17:16 UTC

feanor <juergen.reuter@desy.de> schrieb:
> Thomas Koenig schrieb am Montag, 18. Juli 2022 um 23:21:11 UTC+2:
>> Hi,
>>
>> I've been working on a little pet project of mine, an MPFR binding
>> for Fortran. I have now released a very first version github,
>> at https://github.com/tkoenig1/FMPFR .
>>
>> So, if anybody wants to try out some arbitrary-precision floating
>> point calculations in Fortran, give it a spin.
>
> Nice. Thanks for the effort. I tried it out immediately. I removed the symlinks for the autotools files and replaced them with copies
> from my own project.

Ah, something I will have to do as well.

> Then I compiled/link your example program as
> gfortran foo.f90 -L/home/reuter/local/lib -lfmpfr -I../src -lmpfr
> But both on Ubuntu 18.04 and on Apple Darwin x86_64 I got
> NaN NaN
> NaN NaN

Definitely seems wrong - maybe a too-early version of gfortran?
That would be a bummer.

What does "gfortran -v" give you on your two systems?

Re: MPFR binding for Fortran

<tb6t9p$8le$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2599&group=comp.lang.fortran#2599

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: MPFR binding for Fortran
Date: Tue, 19 Jul 2022 18:31:21 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tb6t9p$8le$1@newsreader4.netcologne.de>
References: <tb4is3$mt2$1@newsreader4.netcologne.de>
<ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>
<tb6oth$57f$1@newsreader4.netcologne.de>
Injection-Date: Tue, 19 Jul 2022 18:31:21 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd6:2699:0:7285:c2ff:fe6c:992d";
logging-data="8878"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 19 Jul 2022 18:31 UTC

Thomas Koenig <tkoenig@netcologne.de> schrieb:
> feanor <juergen.reuter@desy.de> schrieb:
>> Thomas Koenig schrieb am Montag, 18. Juli 2022 um 23:21:11 UTC+2:
>>> Hi,
>>>
>>> I've been working on a little pet project of mine, an MPFR binding
>>> for Fortran. I have now released a very first version github,
>>> at https://github.com/tkoenig1/FMPFR .
>>>
>>> So, if anybody wants to try out some arbitrary-precision floating
>>> point calculations in Fortran, give it a spin.
>>
>> Nice. Thanks for the effort. I tried it out immediately. I removed the symlinks for the autotools files and replaced them with copies
>> from my own project.
>
> Ah, something I will have to do as well.
>
>> Then I compiled/link your example program as
>> gfortran foo.f90 -L/home/reuter/local/lib -lfmpfr -I../src -lmpfr
>> But both on Ubuntu 18.04 and on Apple Darwin x86_64 I got
>> NaN NaN
>> NaN NaN
>
> Definitely seems wrong - maybe a too-early version of gfortran?
> That would be a bummer.
>
> What does "gfortran -v" give you on your two systems?

Never mind that - I have found the bug, and I will fix it.

Re: MPFR binding for Fortran

<tb741u$dg2$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2600&group=comp.lang.fortran#2600

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: MPFR binding for Fortran
Date: Tue, 19 Jul 2022 20:26:38 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tb741u$dg2$1@newsreader4.netcologne.de>
References: <tb4is3$mt2$1@newsreader4.netcologne.de>
<ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>
<tb6oth$57f$1@newsreader4.netcologne.de>
<tb6t9p$8le$1@newsreader4.netcologne.de>
Injection-Date: Tue, 19 Jul 2022 20:26:38 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd6:2699:0:7285:c2ff:fe6c:992d";
logging-data="13826"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 19 Jul 2022 20:26 UTC

Thomas Koenig <tkoenig@netcologne.de> schrieb:
> Thomas Koenig <tkoenig@netcologne.de> schrieb:
>> feanor <juergen.reuter@desy.de> schrieb:
>>> Thomas Koenig schrieb am Montag, 18. Juli 2022 um 23:21:11 UTC+2:
>>>> Hi,
>>>>
>>>> I've been working on a little pet project of mine, an MPFR binding
>>>> for Fortran. I have now released a very first version github,
>>>> at https://github.com/tkoenig1/FMPFR .
>>>>
>>>> So, if anybody wants to try out some arbitrary-precision floating
>>>> point calculations in Fortran, give it a spin.
>>>
>>> Nice. Thanks for the effort. I tried it out immediately. I removed the symlinks for the autotools files and replaced them with copies
>>> from my own project.
>>
>> Ah, something I will have to do as well.
>>
>>> Then I compiled/link your example program as
>>> gfortran foo.f90 -L/home/reuter/local/lib -lfmpfr -I../src -lmpfr
>>> But both on Ubuntu 18.04 and on Apple Darwin x86_64 I got
>>> NaN NaN
>>> NaN NaN
>>
>> Definitely seems wrong - maybe a too-early version of gfortran?
>> That would be a bummer.
>>
>> What does "gfortran -v" give you on your two systems?
>
> Never mind that - I have found the bug, and I will fix it.

OK, fixed now. I fell into a trap that is easy to fall into
when doing C-style rc = "some pure function", this
was optimized away (and I hadn't tested it with -O2 before,
it worked with -O0).

Re: MPFR binding for Fortran

<ec4572e4-69fc-43fb-afe4-33c6cccab65cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2602&group=comp.lang.fortran#2602

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:13cf:b0:6b5:ed16:fc69 with SMTP id g15-20020a05620a13cf00b006b5ed16fc69mr9565751qkl.416.1658320749947;
Wed, 20 Jul 2022 05:39:09 -0700 (PDT)
X-Received: by 2002:a81:6356:0:b0:31c:f779:53a4 with SMTP id
x83-20020a816356000000b0031cf77953a4mr39824062ywb.289.1658320749743; Wed, 20
Jul 2022 05:39:09 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Wed, 20 Jul 2022 05:39:09 -0700 (PDT)
In-Reply-To: <tb741u$dg2$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:cb:ff10:7c57:b0b8:447c:e100:3a44;
posting-account=nzBwnQoAAACNPvrl2_g4iY27wcwaeeNX
NNTP-Posting-Host: 2003:cb:ff10:7c57:b0b8:447c:e100:3a44
References: <tb4is3$mt2$1@newsreader4.netcologne.de> <ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>
<tb6oth$57f$1@newsreader4.netcologne.de> <tb6t9p$8le$1@newsreader4.netcologne.de>
<tb741u$dg2$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ec4572e4-69fc-43fb-afe4-33c6cccab65cn@googlegroups.com>
Subject: Re: MPFR binding for Fortran
From: juergen.reuter@desy.de (feanor)
Injection-Date: Wed, 20 Jul 2022 12:39:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2554
 by: feanor - Wed, 20 Jul 2022 12:39 UTC

Thomas Koenig schrieb am Dienstag, 19. Juli 2022 um 22:26:42 UTC+2:

> > Never mind that - I have found the bug, and I will fix it.
> OK, fixed now. I fell into a trap that is easy to fall into
> when doing C-style rc = "some pure function", this
> was optimized away (and I hadn't tested it with -O2 before,
> it worked with -O0).

Now I cannot link anymore, during compilation I get the warning:
mpfr_glue.c:56:3: warning: implicit declaration of function ‘mpfr_set_float128’; did you mean ‘fmpfr_set_float128’? [-Wimplicit-function-declaration]
56 | mpfr_set_float128 (rop, op, rnd);
| ^~~~~~~~~~~~~~~~~
| fmpfr_set_float128
and at linking the test program I get:
Undefined symbols for architecture x86_64:
"_mpfr_set_float128", referenced from:
_fmpfr_set_float128 in libfmpfr.a(fmpfr_glue.o)
ld: symbol(s) not found for architecture x86_64

mpfr_set_float128 appears in mpfr.h as
__MPFR_DECLSPEC mpfr_set_float128
this seems for Windows DLL !?
On Ubuntu 18.04 compilation and linking works now (with gcc/gfortran 7.5.0), on Darwin x86_64 (Intel, not M1 arm64) it doesn't

Re: MPFR binding for Fortran

<tb9efp$p9l$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2604&group=comp.lang.fortran#2604

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: MPFR binding for Fortran
Date: Wed, 20 Jul 2022 17:36:57 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tb9efp$p9l$1@newsreader4.netcologne.de>
References: <tb4is3$mt2$1@newsreader4.netcologne.de>
<ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>
<tb6oth$57f$1@newsreader4.netcologne.de>
<tb6t9p$8le$1@newsreader4.netcologne.de>
<tb741u$dg2$1@newsreader4.netcologne.de>
<ec4572e4-69fc-43fb-afe4-33c6cccab65cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 20 Jul 2022 17:36:57 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd6:2699:0:7285:c2ff:fe6c:992d";
logging-data="25909"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Wed, 20 Jul 2022 17:36 UTC

feanor <juergen.reuter@desy.de> schrieb:
> Thomas Koenig schrieb am Dienstag, 19. Juli 2022 um 22:26:42 UTC+2:
>
>> > Never mind that - I have found the bug, and I will fix it.
>> OK, fixed now. I fell into a trap that is easy to fall into
>> when doing C-style rc = "some pure function", this
>> was optimized away (and I hadn't tested it with -O2 before,
>> it worked with -O0).
>
> Now I cannot link anymore, during compilation I get the warning:
> mpfr_glue.c:56:3: warning: implicit declaration of function ‘mpfr_set_float128’; did you mean ‘fmpfr_set_float128’? [-Wimplicit-function-declaration]
> 56 | mpfr_set_float128 (rop, op, rnd);
> | ^~~~~~~~~~~~~~~~~
> | fmpfr_set_float128
> and at linking the test program I get:
> Undefined symbols for architecture x86_64:
> "_mpfr_set_float128", referenced from:
> _fmpfr_set_float128 in libfmpfr.a(fmpfr_glue.o)
> ld: symbol(s) not found for architecture x86_64
>
> mpfr_set_float128 appears in mpfr.h as
> __MPFR_DECLSPEC mpfr_set_float128
> this seems for Windows DLL !?
> On Ubuntu 18.04 compilation and linking works now (with gcc/gfortran 7.5.0), on Darwin x86_64 (Intel, not M1 arm64) it doesn't

Fixed, thanks for the reports!

Hope you can do a bit more with it now :-)

Re: MPFR binding for Fortran

<tbbq3a$1h2r$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2607&group=comp.lang.fortran#2607

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!OO38/IUMhGZ55z344I89mQ.user.46.165.242.91.POSTED!not-for-mail
From: juergen.reuter@invalid.com (JRR)
Newsgroups: comp.lang.fortran
Subject: Re: MPFR binding for Fortran
Date: Thu, 21 Jul 2022 17:07:22 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tbbq3a$1h2r$1@gioia.aioe.org>
References: <tb4is3$mt2$1@newsreader4.netcologne.de>
<ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>
<tb6oth$57f$1@newsreader4.netcologne.de>
<tb6t9p$8le$1@newsreader4.netcologne.de>
<tb741u$dg2$1@newsreader4.netcologne.de>
<ec4572e4-69fc-43fb-afe4-33c6cccab65cn@googlegroups.com>
<tb9efp$p9l$1@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="50267"; posting-host="OO38/IUMhGZ55z344I89mQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.0.3
X-Notice: Filtered by postfilter v. 0.9.2
 by: JRR - Thu, 21 Jul 2022 15:07 UTC

Am 20.07.22 um 19:36 schrieb Thomas Koenig:
> feanor <juergen.reuter@desy.de> schrieb:
>> Thomas Koenig schrieb am Dienstag, 19. Juli 2022 um 22:26:42 UTC+2:
>>
>>>> Never mind that - I have found the bug, and I will fix it.
>>> OK, fixed now. I fell into a trap that is easy to fall into
>>> when doing C-style rc = "some pure function", this
>>> was optimized away (and I hadn't tested it with -O2 before,
>>> it worked with -O0).
>>
>> Now I cannot link anymore, during compilation I get the warning:
>> mpfr_glue.c:56:3: warning: implicit declaration of function ‘mpfr_set_float128’; did you mean ‘fmpfr_set_float128’? [-Wimplicit-function-declaration]
>> 56 | mpfr_set_float128 (rop, op, rnd);
>> | ^~~~~~~~~~~~~~~~~
>> | fmpfr_set_float128
>> and at linking the test program I get:
>> Undefined symbols for architecture x86_64:
>> "_mpfr_set_float128", referenced from:
>> _fmpfr_set_float128 in libfmpfr.a(fmpfr_glue.o)
>> ld: symbol(s) not found for architecture x86_64
>>
>> mpfr_set_float128 appears in mpfr.h as
>> __MPFR_DECLSPEC mpfr_set_float128
>> this seems for Windows DLL !?
>> On Ubuntu 18.04 compilation and linking works now (with gcc/gfortran 7.5.0), on Darwin x86_64 (Intel, not M1 arm64) it doesn't
>
> Fixed, thanks for the reports!
>
> Hope you can do a bit more with it now :-)
>
>
Thanks, Thomas. I still have an issue on Darwin x86_64:
Undefined symbols for architecture x86_64:
"_fmpfr_set_ld", referenced from:
___fmpfr_oper_MOD_ass_set_ld in libfmpfr.a(fmpfr_oper.o)
___fmpfr_oper_MOD_fun_set_ld in libfmpfr.a(fmpfr_oper.o)
ld: symbol(s) not found for architecture x86_64

I think the C compiler also needs the preprocessor flags that you
only hand over to the Fortran code, I hackfixed this by

AM_CFLAGS = = @fc_preprocessor_flag@ @fc_preflags@

in the src/Makefile.am
but there is probably a more elegant way. Then it also works on Darwin
x86_64. I haven't tried the arm64 yet.

--
Juergen Reuter
Theoretical Particle Physics
Deutsches Elektronen-Synchrotron (DESY)
Hamburg, Germany

Re: MPFR binding for Fortran

<tbc0ah$tg8$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2608&group=comp.lang.fortran#2608

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: MPFR binding for Fortran
Date: Thu, 21 Jul 2022 16:53:37 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tbc0ah$tg8$1@newsreader4.netcologne.de>
References: <tb4is3$mt2$1@newsreader4.netcologne.de>
<ec953f12-ede3-48a4-8dfd-a97983ecb20cn@googlegroups.com>
<tb6oth$57f$1@newsreader4.netcologne.de>
<tb6t9p$8le$1@newsreader4.netcologne.de>
<tb741u$dg2$1@newsreader4.netcologne.de>
<ec4572e4-69fc-43fb-afe4-33c6cccab65cn@googlegroups.com>
<tb9efp$p9l$1@newsreader4.netcologne.de> <tbbq3a$1h2r$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 21 Jul 2022 16:53:37 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd6-2699-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd6:2699:0:7285:c2ff:fe6c:992d";
logging-data="30216"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Thu, 21 Jul 2022 16:53 UTC

JRR <juergen.reuter@invalid.com> schrieb:
> Am 20.07.22 um 19:36 schrieb Thomas Koenig:
>> feanor <juergen.reuter@desy.de> schrieb:
>>> Thomas Koenig schrieb am Dienstag, 19. Juli 2022 um 22:26:42 UTC+2:
>>>
>>>>> Never mind that - I have found the bug, and I will fix it.
>>>> OK, fixed now. I fell into a trap that is easy to fall into
>>>> when doing C-style rc = "some pure function", this
>>>> was optimized away (and I hadn't tested it with -O2 before,
>>>> it worked with -O0).
>>>
>>> Now I cannot link anymore, during compilation I get the warning:
>>> mpfr_glue.c:56:3: warning: implicit declaration of function ‘mpfr_set_float128’; did you mean ‘fmpfr_set_float128’? [-Wimplicit-function-declaration]
>>> 56 | mpfr_set_float128 (rop, op, rnd);
>>> | ^~~~~~~~~~~~~~~~~
>>> | fmpfr_set_float128
>>> and at linking the test program I get:
>>> Undefined symbols for architecture x86_64:
>>> "_mpfr_set_float128", referenced from:
>>> _fmpfr_set_float128 in libfmpfr.a(fmpfr_glue.o)
>>> ld: symbol(s) not found for architecture x86_64
>>>
>>> mpfr_set_float128 appears in mpfr.h as
>>> __MPFR_DECLSPEC mpfr_set_float128
>>> this seems for Windows DLL !?
>>> On Ubuntu 18.04 compilation and linking works now (with gcc/gfortran 7.5.0), on Darwin x86_64 (Intel, not M1 arm64) it doesn't
>>
>> Fixed, thanks for the reports!
>>
>> Hope you can do a bit more with it now :-)
>>
>>
> Thanks, Thomas. I still have an issue on Darwin x86_64:
> Undefined symbols for architecture x86_64:
> "_fmpfr_set_ld", referenced from:
> ___fmpfr_oper_MOD_ass_set_ld in libfmpfr.a(fmpfr_oper.o)
> ___fmpfr_oper_MOD_fun_set_ld in libfmpfr.a(fmpfr_oper.o)
> ld: symbol(s) not found for architecture x86_64
>
> I think the C compiler also needs the preprocessor flags that you
> only hand over to the Fortran code, I hackfixed this by
>
> AM_CFLAGS = = @fc_preprocessor_flag@ @fc_preflags@
>
> in the src/Makefile.am
> but there is probably a more elegant way. Then it also works on Darwin
> x86_64. I haven't tried the arm64 yet.

Again, thanks for the testing!

I have just added the -D flags to configure.ac and (which is also
important) added a #define MPFR_WANT_FLOAT128 if float128 is supported.

I hope it works now.

Best regards

Thomas

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor