From: Manfred Schwarb <manfred99@gmx.ch>
To: "Sewell, Granville" <sewell@utep.edu>,
"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re: gfortran -static on MACs
Date: Sat, 10 Feb 2018 19:45:00 -0000 [thread overview]
Message-ID: <bf18f3d7-80d4-178b-e696-038ea44a9b70@gmx.ch> (raw)
In-Reply-To: <bf0a41922e2e411fa9ffbf492133fff9@ITDSRVMBX000.utep.edu>
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.
>
> 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)
HTH,
Manfred
> So it seems to be impossible to produce any executable with gfortran on a MAC that has the dynamic libraries loaded
> so it can run elsewhere.
>
> Is there a way to get -static to work on MACs, or any other way to produce a portable executable?
>
> Thanks for your help
>
> Granville Sewell
>
next prev parent reply other threads:[~2018-02-10 19:45 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 [this message]
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
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=bf18f3d7-80d4-178b-e696-038ea44a9b70@gmx.ch \
--to=manfred99@gmx.ch \
--cc=fortran@gcc.gnu.org \
--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).