This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Grant, > Thanks for your response. Unfortunately, I think you might have missed > the crucial point, which is that netcdf.mod couldn't be found ANYWHERE on > my system after the fink installation. Oops, sorry, I did miss that. Now I see your fink installation was installing the latest netcdf-4.2.1.1 C library and an older netcdf-3.6.3 combined C library and Fortran library. What I would recommend is installing the 4.2.1.1 C library, as you have done, then compiling the netCDF Fortran library version 4.2 from the source tarball, telling it where you installed the C library, as described here: http://www.unidata.ucar.edu/netcdf/docs/netcdf-fortran-install.html You'll see from the above that it makes a difference whether the netCDF C library is installed as a shared library (recommended) or as a static library (will require more library flags to compile netCDF applications). It would be good to uninstall whatever fink installed for the netcdf-3.6.3 version, as we haven't tested the combination you have installed. --Russ > So I have since tried to bypass the fink installation and instead install > it directly from the tarballs on the Unidata page. This too proved a > challenge in that apparently you can't use /usr/bin/gcc in the compilation > but rather must install and use /sw/bin/gcc. But even after that, I'm > still running into problems in that 'make check' for the Fortran add-on > reports failures of two out of three tests. Yes, /usr/bin/gcc is the Apple C compiler, which apparently is incompatible with some versions of gfortran. Also gcc compiles 64-bit objects as a default whereas some versions of gfortran build 32-bit objects unless you explicitly include the -m64 flag or use the "-arch x86_64". NetCDF works fine using a 32-bit model, so you could try -m32 with gcc and the default with gfortran. Also with some versions of XTools on MacOS-X, we need to set the environment variable lt_cv_ld_force_load=no before running configure, though I don't know if that's necessary with the latest tools ... --Russ > To summarize, I need to install a gfortran (with support for Fortran-90) > compatible netcdf library on my Mac running 10.6.8, but every method I've > tried so far has failed for various reasons. If any of the above suggestions work, please let us know.> On Mon, 24 Sep 2012, Unidata netCDF Support wrote: > > > Hi Grant, > > > > Sorry to have taken so long to respond to your question ... > >> Operating System: Mac OS X 10.6.8 > >> Description of problem: > >> > >> I'm new to netcdf and am trying to compile a simple F90 program that > >> has the 'use netcdf' statement at the top. The compile fails with the > >> message that netcdf.mod can't be found. I understand from a web search > >> that netcdf.mod should probably be in /sw/lib somewhere, but it doesn't > >> appear to exist on the system at all. > > > > The netcdf.mod file (which some compilers name "netcdf.MOD") is typically > > stored > > in an "include/" directory, such as /sw/include/ rather than /sw/lib/. > > It's the > > Fortran-90 module file that defines the library interfaces for Fortran-90 > > programs > > that make use of the netCDF library. > > > >> Here's my compile line: > >> > >> gfortran t.f90 -L/sw/lib -lnetcdf -L/sw/lib/netcdf-gfortran -lnetcdff > >> > >> Here's what's installed (marked with 'i'): > >> > >> fink list netcdf > >> Information about 11902 packages read in 2 seconds. > >> nco-netcdf 4.0.9-1 OBSOLETE, use > >> 'nco' instead > >> i netcdf 3.6.3-6 Interface & > >> lib for array-based data access > >> (i) netcdf-bin 4.2.1-1 Array-based > >> data access, user programs > >> netcdf-c7 4.2.1-1 Array-based data > >> access, C headers and docs > >> (i) netcdf-c7-shlibs 4.2.1-1 Array-based > >> data access, C library > >> netcdf-cxx4 4.2-2 Array-based data > >> access, C++ headers and docs > >> netcdf-cxx4-shlibs 4.2-2 Array-based data > >> access, C++ library > >> netcdf-fortran5 4.2-4 Array-based data > >> access, Fortran headers/doc > >> netcdf-fortran5-shlibs 4.2-4 Array-based data > >> access, Fortran library > >> netcdf-g95 3.6.3-9 Interface & lib > >> for array-based data access > >> netcdf-g95-shlibs 3.6.3-9 Interface & lib > >> for array-based data access > >> i netcdf-gfortran 3.6.3-9 Interface & > >> lib for array-based data access > >> i netcdf-gfortran-shlibs 3.6.3-9 Interface & > >> lib for array-based data access > >> netcdf-perl-pm588 1.2.3-7 Perl extension for > >> netCDF datasets access > >> i netcdf-shlibs 3.6.3-6 Interface & > >> lib for array-based data access > >> netcdf7 4.1.3-9 Array-based data > >> access, headers and docs > >> netcdf7-bin 4.1.3-9 Array-based data > >> access, interface > >> netcdf7-gfortran 4.1.3-11 Interface & lib > >> for array-based data access > >> netcdf7-gfortran-shlibs 4.1.3-11 Interface & lib > >> for array-based data access > >> netcdf7-shlibs 4.1.3-9 Array-based data > >> access, headers and docs > >> > >> > >> Please let me know if I overlooked something I should have installed. > > > > This email and the followup from the fink users mailing list may be helpful: > > > > http://www.mail-archive.com/address@hidden/msg35667.html > > http://www.mail-archive.com/address@hidden/msg35668.html > > > > Also, with a MacOS-X system you can use the "Searchlight" tool in the upper > > right on the menubar to find files like "netcdf.mod". When a list of such > > files > > appears, just hold down the option-command key combination while your cursor > > is over the name, and the path to the file will appear at the bottom of the > > information window about the file, to the left of the list. > > > > --Russ > > > > Russ Rew UCAR Unidata Program > > address@hidden http://www.unidata.ucar.edu > > > > > > > > Ticket Details > > =================== > > Ticket ID: JSU-487825 > > Department: Support netCDF > > Priority: Normal > > Status: Closed > > > > > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: JSU-487825 Department: Support netCDF Priority: Normal Status: Closed