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.
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
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?
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.
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).
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
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 :-)
Am 20.07.22 um 19:36 schrieb Thomas Koenig:
feanor <juergen.reuter@desy.de> schrieb:Thanks, Thomas. I still have an issue on Darwin x86_64:
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 :-)
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.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 159 |
Nodes: | 16 (0 / 16) |
Uptime: | 98:54:22 |
Calls: | 3,209 |
Files: | 10,563 |
Messages: | 3,009,783 |