public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* statically compile in libquadmath
@ 2017-07-27 13:24 Manfred Schwarb
  2017-07-28  9:22 ` Kay Diederichs
  2017-08-08 12:10 ` Manfred Schwarb
  0 siblings, 2 replies; 3+ messages in thread
From: Manfred Schwarb @ 2017-07-27 13:24 UTC (permalink / raw)
  To: fortran

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)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: statically compile in libquadmath
  2017-07-27 13:24 statically compile in libquadmath Manfred Schwarb
@ 2017-07-28  9:22 ` Kay Diederichs
  2017-08-08 12:10 ` Manfred Schwarb
  1 sibling, 0 replies; 3+ messages in thread
From: Kay Diederichs @ 2017-07-28  9:22 UTC (permalink / raw)
  To: fortran

On 2017-07-27 15:24, Manfred Schwarb wrote:
> 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)
> 
> 
> 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
> 

I would very much welcome this. It has been a nightmare to statically
link with gfortran for distribution of binaries to machines which not
necessarily have gfortran libraries.

Kay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: statically compile in libquadmath
  2017-07-27 13:24 statically compile in libquadmath Manfred Schwarb
  2017-07-28  9:22 ` Kay Diederichs
@ 2017-08-08 12:10 ` Manfred Schwarb
  1 sibling, 0 replies; 3+ messages in thread
From: Manfred Schwarb @ 2017-08-08 12:10 UTC (permalink / raw)
  To: fortran

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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-08 12:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-27 13:24 statically compile in libquadmath Manfred Schwarb
2017-07-28  9:22 ` Kay Diederichs
2017-08-08 12:10 ` Manfred Schwarb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).