gfortran -static on MACs

Sewell, Granville sewell@utep.edu
Sat Feb 10 13:40:00 GMT 2018


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.

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



More information about the Fortran mailing list