statically compile in libquadmath
Manfred Schwarb
manfred99@gmx.ch
Tue Aug 8 12:10:00 GMT 2017
Am 27.07.2017 um 15:24 schrieb Manfred Schwarb:
> Hi,
>
> there is the long standing annoyance that it is very hard to
> statically compile in libquadmath.
> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539 and
> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00375.html.
>
> Unfortunately, the patch from FX went nowhere, and the
> second suggestion of Tobias (gfortran -specs=myspecfile) does not work.
>
> There remain two working options:
> 1) compile with gcc:
> # gcc -static-libgcc -Wl,-Bstatic -lgfortran -lquadmath -Wl,-Bdynamic -lm
> 2) modify <prefix>/lib*/libgfortran.spec of the compiler itself
>
> It crossed my mind that one could do the second option in a conditional way:
>
> --- libgfortran.spec.old 2017-05-29 15:55:24.939239222 +0000
> +++ libgfortran.spec 2017-07-27 12:55:05.006518676 +0000
> @@ -5,4 +5,4 @@
> #
>
> %rename lib liborig
> -*lib: %{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed} -lm %(libgcc) %(liborig)
> +*lib: %{static-libgfortran:--as-needed} %{static-libgfortran:-Bstatic} -lquadmath %{static-libgfortran:-Bdynamic} %{static-libgfortran:--no-as-needed} -lm %(libgcc) %(liborig)
>
Well, --as-needed and -Bstatic together makes not really much sense.
And, according to my experiences, somehow --as-needed does not work at all in this context,
libquadmath will always be linked in, even when there is no use of quad precision.
So the following would make more sense:
--- libgfortran.spec.old 2017-05-29 21:46:01.036867084 +0000
+++ libgfortran.spec 2017-08-08 12:04:01.500558409 +0000
@@ -5,4 +5,4 @@
#
%rename lib liborig
-*lib: %{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed} -lm %(libgcc) %(liborig)
+*lib: %{static-libgfortran:-Bstatic} -lquadmath %{static-libgfortran:-Bdynamic} -lm %(libgcc) %(liborig)
>
> This would couple -static-libgfortran to also compile in libquadmath.
> While such a hack is not pretty, it would probably match what most users want,
> namely to be able to run gfortran programs on other boxes without installed gfortran compiler
> (and therefore most probably also without libquadmath),
> or to enable additional compile optimizations to gain optimal performance.
>
> Thoughts?
>
> Cheers,
> Manfred
>
>
> PS1: I don't have any gcc paperwork assignments
> PS2: I'm off for holidays the next few days, so response will be delayed
>
More information about the Fortran
mailing list