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.
>To: address@hidden >Subject: installing netCDF with Porland Group Compilers >Date: Fri, 15 Mar 2002 17:08:27 -0500 >X-Mailer: KMail [version 1.2] >MIME-Version: 1.0 >Message-Id: <address@hidden> >Content-Transfer-Encoding: 8bit Hi Ryan, > I am using netCDF on a Linux workstation, RH 7.2 o/s. The netCDF program was > compiled using g77,gcc,g++ compilers. However, I have a fortran program that > tries to read a binary file that is > 2GB and write it's output in netCDF > format. The program compiles, using g77, with no errors but when I run the > executable it crashes when it tries to read the > 2GB file. ... If you are *reading* a non-netCDF binary file when the crash occurs, that doesn't sound like a netCDF problem. Note that you can't write a netCDF file greater than 2GB unless: - You are running on a platform that has Large File Support (LFS) - You have compiled the netCDF library to specify use of LFS, for example with CFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' - The file is structured so as not to require 64-bit offsets to netCDF variables, see: http://www.unidata.ucar.edu/packages/netcdf/f90/Documentation/f90-html-docs/guide9.html#2236524 for example. Also note that 2GB netCDF files are not portable to platforms without LFS, so you lose one of the advantages of netCDF by deciding to use large files. > ... I have > Portland > Group Fortran 77 and 90 compilers on my machine which can read/write files > > 2GB, but when I compile my program using them I get a series of undefined > references to all the netCDF functions. Does anyone have any insight to my > problem? In general, you must build the netCDF Fortran interfaces using the same compilers you will use to build and link Fortran programs later. In particular, it doesn't work to build the netCDF library using g77 as the Fortran compiler and later try to link with programs compiled with a Portland Group compiler. If you will need to link with code compiled with several different Fortran compilers, you will need to build several versions of the Fortran interfaces. To build netCDF with Portland Group compilers, you might try one of the settings suggested in the installation instructions at: http://www.unidata.ucar.edu/packages/netcdf/INSTALL.html for example: CC=/usr/bin/gcc CFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' CPPFLAGS='-DNDEBUG -DpgiFortran' FC=/opt/pgi/linux86/bin/pgf90 FFLAGS='-O -w' CXX=/usr/bin/g++ --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu