Re: [netcdfgroup] NetCDF on OS X

Ian Harris <i.harris@xxxxxxxxx> writes:

> Hi,
> I've resubbed after a long absence, because I'm trying to get the  
> NetCDF libraries (including those for F77 and F90) installed on a Mac  
> (2xG5 PowerPc Processors, OS 10.4.10).
> The problem is that, when I try the first f77 test program  
> ('simple_xy_wr.f'), the compilation fails with the familiar  
> underscore-laden symbol errors.
> I've tried downloading the binaries, and compiling from source. I've  
> tried all combinations of gfortran and g77 for both NetCDF install  
> and test compile. I've played with the g95 -no_second_underscore (and  
> other!) options. I've spent two days on it so far and I'm going  
> quietly mad..
> Has anyone managed to get the NetCDF libraries (pref. 3.6.2 but by  
> now I'll settle for anything) working on OS X? Is there a foolproof  
> guide anywhere?
> I've looked at the thread earlier this year but it doesn't seem to  
> help, sorry.
> System, etc details:
> Mac OS X 10.4.10
> Dual 2 GHz PowerPC G5
> g77  - not currently installed (has been tried)
> gfortran version GCC 4.0.2
> Cheers

Howdy Ian!

I think your problem may be related to a change in how gfortran
handles name mapping. See here:

Try setting CPPFLAGS to -DpgiFortran and rebuilding netCDF-3.6.2.

(An easy porting thing to do is see whether gFortran or pgiFortran is
turned on in config.h. Then try the other. ;-)

This problem has been fixed in the netCDF-3 snapshot, so you can just
get it and see if it does the correct thing for you:

(Snapshots are now also available from the netCDF home page:

The 3.6.2 snapshot and release are known to build or OS X - your
problems are related to gfortran. Many people have apparently
upgraded beyond version 4.0. My main test machine uses 4.1. 

If the snapshot doesn't work for you, please let me know.

3.6.2 also builds under g77, though not the F90 API.



Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx