Hi Russ.
Thank you for this helpful summary for installing netCDF-Fortran
version 4.2. A minor difference was that I did not use sudo because I
am on a managed computer network with no sudo permission. So instead
I used a non-standard location via --prefix. With that, plain "make
install" worked fine.
Another minor difference is that I am using -L on the compile line for
applications, rather than using the DYLD_LIBRARY_PATH environment
variable. My understanding is that either linkage method is valid on
Mac OS.
I would like to report successful build and application testing of the
netCDF-Fortran v4.2 with core library netCDF-4.2-rc1. Once I figured
out what the heck I was doing, everything went smoothly. Here are the
particular components and options that I used:
Platform = Mac OS 10.6.8 on Intel Mac
netCDF4 API is enabled (by default)
OpenDAP is disabled (for simplicity)
netCDF C++ API was not added
C compiler = gcc 4.5.2
Fortran compiler = gfortran 4.5.2
HDF5 version 1.8.8 (without the fortran interface)
ZLIB version 1.2.5
SZIP not included
Also I used shared libraries rather than static for all components,
and for linking my application programs. Static would probably also
work; I just did not test this.
--Dave
On Fri, Jan 27, 2012 at 2:35 PM, Russ Rew <russ@xxxxxxxxxxxxxxxx> wrote:
> Hi Dave,
>
>> Is there any install documentation for the new separate fortran
>> library, netCDF-Fortran version 4.2? There is some talk about build
>> details in the netcdfgroup archives from October 2010, at the time of
>> initial release. The distribution README file mentions an INSTALL
>> file, which is not included. Otherwise, I can't find this in any of
>> the likely places.
>
> Thanks for noticing the missing netCDF-Fortran version 4.2 INSTALL
> documentation. It looks like the README is also just a copy from the
> previous combined C/Fortran/C++ source distribution. We'll provide the
> missing documentation in the next minor release of netCDF-Fortran, and
> something on the Web documentation page soon.
>
> In the meantime, this will work:
>
> 1. Make sure the netCDF C library is already installed.
> 2. Set the CPPFLAGS and LDFLAGS environment variables to specify
> where the netCDF C library is installed.
> 3. Run the configure script from the Fortran release, setting
> configure options such as "--prefix", if needed.
> 4. Run "make check".
> 5. Run "sudo make install".
>
> As an example, here's what worked for me from the top-level directory of
> the Fortran release:
>
> LD_LIBRARY_PATH=/usr/local/lib CPPFLAGS=-I/usr/local/include ./configure
> make check
> sudo make install
>
> If you use shared libraries (the default), you will only need to use
> -lnetcdff to link with the installed Fortran library. If the shared
> libraries are installed somewhere not searched by default, you'll need
> to set the LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH for MacOS X) to run
> programs linked with the Fortran library.
>
> If you use static libraries, you'll have to specify -lnetcdf and other
> libraries used when the netCDF C library was built.
>
> --Russ