public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Janus Weil <janus@gcc.gnu.org>
To: Manfred Schwarb <manfred99@gmx.ch>,
	Francois Xavier Coudert <fxcoudert@gmail.com>
Cc: "Sewell, Granville" <sewell@utep.edu>,
	"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re: gfortran -static on MACs
Date: Tue, 13 Feb 2018 19:55:00 -0000	[thread overview]
Message-ID: <CAKwh3qjsLYegLO1V3_N_r5uOUGv1pkUQCEZ0C2oXz8T44K4NBA@mail.gmail.com> (raw)
In-Reply-To: <ba1c3112-7450-b73b-509c-8d5fed871862@gmx.ch>

Dear Sewell,

>> Bottom line is I simple want to create an executable from my Fortran program that people on other MAC OSX
>> systems can run without having gfortran installed.   If that is really impossible

I don't think it's impossible. That is basically what
-static-libgfortran is for, which in principle seems to work for you.
Problem is, it's not complete in a sense: It links your program to the
static version of libgfortran, but still uses a dynamic libquadmath.

I think the cleanest solution to this problem is to add a
-static-libquadmath flag to gfortran, as proposed in PR 46539. Maybe
we can get FX to dust off his old patch for this PR and make it fit
for GCC 9?

(Btw, a quick fix for you might be to simply distribute libquadmath.so
together with your application.)

Cheers,
Janus




>> Sent: Monday, February 12, 2018 1:12 PM
>> To: Manfred Schwarb
>> Cc: Sewell, Granville; fortran@gcc.gnu.org
>> Subject: Re: gfortran -static on MACs
>>
>>> Am 10.02.2018 um 14:40 schrieb Sewell, Granville:
>>>>
>>>> The Linux and Windows versions of Gfortran work with
>>>>
>>>>   gfortran -static  -o prog.exe prog.f
>>>>
>>>> to produce an executable that can be run on other systems where gfortran is not installed.
>>>>
>>>> But the -static option does not seem to work with gfortran on a MAC, I get
>>>>    ld: library not found for -lcrt0.o
>>>> and another person with a different version of gfortran on his MAC gets the same results.
>>
>> Statically linked executables are not supported on Mac OS, see:
>> https://developer.apple.com/library/content/qa/qa1118/_index.html
>>
>>
>>
>>>>  gfortran -static-libgfortran prog.f
>>>>
>>>> works, but the executable does not even seem to run on other systems with a different version of gfortran.
>>>>
>>>
>>> probably the following patch will help somewhat. You have to patch all files named
>>> "libgfortran.spec" in the path of your _installed_ compiler. With this change
>>> "-static-libgfortran" will imply static linking to libquadmath.
>>>
>>> --- 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
>>
>>
>> A -static-libquadmath flag has been proposed in the past, but
>> apparently the patch has never been committed:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539
>>
>> Would certainly be good to have this.
>>
>> Cheers,
>> Janus
>>
>

      reply	other threads:[~2018-02-13 19:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <da765f0e461543fc93eccb142b41f308@ITDSRVMBX000.utep.edu>
2018-02-10 13:40 ` Sewell, Granville
2018-02-10 19:45   ` Manfred Schwarb
2018-02-12 20:12     ` Janus Weil
     [not found]       ` <70d853eea5aa46e5b2410afece89c43a@ITDSRVMBX000.utep.edu>
2018-02-12 23:10         ` Manfred Schwarb
2018-02-13 19:55           ` Janus Weil [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKwh3qjsLYegLO1V3_N_r5uOUGv1pkUQCEZ0C2oXz8T44K4NBA@mail.gmail.com \
    --to=janus@gcc.gnu.org \
    --cc=fortran@gcc.gnu.org \
    --cc=fxcoudert@gmail.com \
    --cc=manfred99@gmx.ch \
    --cc=sewell@utep.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).