gfortran on MacOS X
If you just want to use the precompiled gfortran, use
APT/RPM as follows.
How to Install a Precompiled Binary
Package
A binary package is available as an RPM which can be installed using
APT/RPM as
$ su
# apt-get update
# apt-get install gcc
# apt-get clean
# exit
Notice that this will replace your default gcc compilers (gcc and g++), which is necessary to allow mixed use of C, C++, and FORTRAN for a single application.
The default gcc compilers can be switched by using the "update-altarnatives" command as follows
and answering the questions:
$ su
# update-alternatives --config gcc
# exit
REMARKS
- As a general rule, you should make sure
that optimization does not change your results.
- Avoid too many else if's in the same
level. You sometimes need to nest them, if the compiler abends.
- gfortran forbids jumping into a different
"IF" block.
- gfortran does not initialize a "BLOCK DATA"
even if you declare it "EXTERNAL". In order to force it, say "blkdat",
initialized, I needed a trick like
external blkdat
call dummysub(blkdat)
with
subroutine dummysub(a)
return
end
- gfortran now returns IOSTAT=5002 (instead of IOSTAT=3 as with gcc-4.2 or older), when the EOF is
reached for an random access file, which behavior is different from
that of g77.
- gcc, g++, and gfortran now use system's
math library (libm.dylib), whenever possible, which sometimes causes a
problem, since some functions in libm behave differently from those
used to be supplied by gcc-associated libraries (a typical example is
"csqrt": see cernlib page).
- Here is a sample FCFLAGS I usually use to compile my legacy
fortran programs:
FCFLAGS = -fno-automatic
-fno-second-underscore -fno-range-check
Back
to Keisuke Fujii's HEP on X Page
keisuke.fujii@kek.jp Dec. 28, 2016