Compiling NetCDF with g95 or gfortran on a PowerPC Mac.
Timothy Hume
T.Hume at bom.gov.au
Tue Sep 12 21:49:51 MDT 2006
Hi,
I believe I have found a solution to the problem I was having compiling
NetCDF on my Mac.
Here is the description of the system I'm compiling NetCDF on:
Machine: PowerBook G4 12" screen
OS: MacOS X 10.4 (Tiger)
I have installed the latest XCode from Apple (version 2.4), but I think
earlier versions will probably work. I have a fairly recent (last month or
two) version of g95.
Here are the compile instructions:
In a shell:
export CC=gcc
export CXX=g++
export FC=/Users/tim/bin/g95 # (The path to g95)
export F90=/Users/tim/bin/g95
export CFLAGS='-O2'
export CXXFLAGS='-O2'
export FFLAGS='-O2'
export CPPFLAGS='-DNDEBUG -Dfc2Fortran'
export LIBS='-lSystemStubs' # I think this is
the critical thing.
./configure --prefix=/Users/tim
make
make test
make install
I'm not sure if all the environment variables are necessary (you could dump
the CFLAGS, CXXFLAGS, FFLAGS without any harm), but I'm sure the LIBS
variable is required (the g95 manual mentions the need for -lSystemStubs).
The fortran tests compile with lots warning messages which look similar to
this:
Inconsistent types (REAL(8)/REAL(4)) in actual argument lists at (1) and (2)
In file ftest.F:1383
However, once the test code is run, it seems OK.
I think the -lSystemStubs will always be required when you want to use the
Fortran90 NetCDF interface.
Tim Hume
Bureau of Meteorology Research Centre
Melbourne
Australia
More information about the netcdfgroup
mailing list