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.
Hans, > From: Hans Vahlenkamp <address@hidden> > Subject: Compiling netCDF 3.4 with NAG and Lahey/Fujitsu F95 > Organization: Geophysical Fluid Dynamics Lab/NOAA > Keywords: 200007290240.e6T2ebT21779 netCDF Fortran NAG Lahey FugitsuF95 The above message contained the following: > We're currently looking at Fortran compilers for Linux and I'm trying to > compile the netCDF 3.4 library which each of them. GNU's g77 and Portland > Group's pgf90 both compile the library and run through the tests without a > problem. I am having a problem with NAG's f95 and Lahey/Fujitsu's lf95. > For the NAG f95 I have this environment: > > setenv CXX /usr/bin/g++ > setenv CC /usr/bin/gcc > setenv CFLAGS '-march=pentiumpro -O2' > setenv FC /usr/local/nf95/bin/nf95 > setenv FFLAGS -mismatch > setenv CPPFLAGS -DNAGf90Fortran > > The library compiles, but "make test" stops here: > > ... > make[2]: Entering directory `/home/hnv/netcdf/netcdf-3.4/src/nf_test' > /usr/local/nf95/bin/nf95 -o nf_test -mismatch test_get.o test_put.o > nf_error.o nf_test.o test_read.o test_write.o util.o fortlib.o > ../libsrc/libnetcdf.a -lm > nf_test.o: In function `main': > nf_test.o(.text+0x253): undefined reference to `getarg_' > nf_test.o(.text+0x28d): undefined reference to `iargc_' > nf_test.o(.text+0x2ec): undefined reference to `getarg_' > nf_test.o(.text+0x3bc): undefined reference to `getarg_' > collect2: ld returned 1 exit status > make[2]: *** [nf_test] Error 1 > make[2]: Leaving directory `/home/hnv/netcdf/netcdf-3.4/src/nf_test' > make[1]: *** [subdir_target] Error 1 > make[1]: Leaving directory `/home/hnv/netcdf/netcdf-3.4/src' > make: *** [nf_test/test] Error 2 It appears that the NAG f95 environment on your system doesn't support getopt(3f), which is the standard way of obtaining command-line arguments in a Unix environment. It could be that you need to add a particular library reference to the command that builds the test program "fortran/nf_test". I don't know what that referece might be (check with your documentation). If you can't find any support for getopt(3f), then I would complain to the vendor of the development environment for not supplying a complete environment. > There is no mention of the Lahey/Fujitsu lf95 in "cfortran.h" 4.1, so I use > this environment (assuming the Fortran/C interface is the same as for NAG's > f95?): We have no experience building the Fortran interface of the netCDF package using the Lahey Fortran compiler. It could be that it uses the same Fortran-calling-C conventions as NAG Fortran -- but if experience is anything to go by, then it probably doesn't. You might try posting to the netcdf mailing-list. Perhaps someone on it has successfully built the netCDF package using the Lahey Fortran compiler. > setenv CXX /usr/bin/g++ > setenv CC /usr/bin/gcc > setenv CFLAGS '-march=pentiumpro -O2' > setenv FC /usr/local/lf95/bin/lf95 > setenv CPPFLAGS -DNAGf90Fortran > > The library compiles, but "make test" stops here: > > ... > make[2]: Entering directory `/home/hnv/netcdf/netcdf-3.4/src/fortran' > + /usr/local/lf95/bin/lf95 -c -O ftest.F > "ftest.F", line 7: error: #include: cannot find file "nfconfig.inc" The file "fortran/nfconfig.inc" should have been created by the configure script when it was executed. That it wasn't indicates a severe problem. You should be able to (re)create it by executing the command "./config.status" in the top-level source directory. Failing that, then your best bet is to start over from scratch: 1. Go to the top-level source directory. 2. Performs steps 3 through 9 near the end of the INSTALL file. ... > I would appreciate any suggestions you may have on possible compiler > switches to complete the tests for the NAG f95 and Lahey/Fujitsu lf95. > > Thanks, > > -- > > +------------------------------------------------------------------------+ > |Hans Vahlenkamp Phone: 609-452-6532 | > |Software Engineer E-Mail: address@hidden | > |Geophysical Fluid Dynamics Lab/NOAA Mail: P.O. Box 308 | > |Princeton University Forrestal Campus Princeton, NJ 08542 USA| > +------------------------------------------------------------------------+ Regards, Steve Emmerson <http://www.unidata.ucar.edu>