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.
Darin, > Subject: netCDF fortran tests fail > To: address@hidden > From: Darin Ernst <address@hidden> > Organization: . > Keywords: 199601171614.AA16237 In the above message you wrote: > No matter what settings I use for the fortran parts, I always seem > to see the following tests failed upon making test in netCDF. > All the C tests are successful, and there are no compile errors. > > I'm using Linux with the Promula Fortran compiler, which is a robust > compiler that supports VAX and Sun extensions. I have used this > compiler successfully on several thousand fortran modules, mixing > fortran and C, so generally, I know it is working. I made up a linux.m4 > file and used the manual for the compiler to pick settings. I'm > appending that below the error report. I'm using > > libc-4.6.27 > a.out format > gcc-2.6.3 > Promula FORTRAN pfc (fortran->c translator; in script to behave as compiler) > > The system successfully made and tested the HDF distribution, except for > the netCDF parts, which give the same errors as below. This was from > the netCDF distribution 2.4 beta 6: > > - --------------------------------------------------------/ cd fortran; make > test > > making `test' in directory /scsi/usr/src/netcdf-2.4-beta6/src/fortran > > make[1]: Entering directory `/scsi/usr/src/netcdf-2.4-beta6/src/fortran' > ar rcuv ../libsrc/libnetcdf.a jackets.o > ranlib ../libsrc/libnetcdf.a > pf77 -o ftest -O2 -extend -stdio -I/scsi/usr/src/netcdf-2.4-beta6/src/fortran > ftest.o > - -L../libsrc -lnetcdf > ./ftest > *** Testing nccre ... > *** Testing ncddef ... > ncdimdef: dimension "(null)" in use with index 0 > ncdimdef: dimension "(null)" in use with index 0 > ncdimdef: dimension "(null)" in use with index 0 > ncdimdef: dimension "(null)" in use with index 0 > *** Testing ncvdef ... > ncvardef: Bad dimension id -2 > ncvardef: Invalid number of dimensions 4 > 1 > ncvardef: Invalid number of dimensions 4 > 1 > ncvardef: Invalid number of dimensions 2 > 1 > *** Testing ncapt, ncaptc ... > ncattput: -2 is not a valid variable id > ncattput: -2 is not a valid variable id > ncattput: -2 is not a valid variable id > ncattput: -2 is not a valid variable id > ncattput: -2 is not a valid variable id > *** Testing ncclos ... > *** Testing ncvpt1 ... > ncvarinq: -2 is not a valid variable id > ncvarinq: -2 is not a valid variable id > ncvarinq: -2 is not a valid variable id > *** Testing ncvgt1 ... > ncvarinq: -2 is not a valid variable id > error in ncvgt1 long: 0 .ne. 1000 > ncvarinq: -2 is not a valid variable id > error in ncvgt 1 float: 0.0000000 not close to 3.141590 > ncvarinq: -2 is not a valid variable id > error in ncvgt1 double: 0.0000000000000000 not close to > 0.3333333333000000 > *** Testing ncvpt ... > ncvarinq: -2 is not a valid variable id > ncvarinq: -2 is not a valid variable id > ncvarinq: -2 is not a valid variable id > ncvarinq: -2 is not a valid variable id > *** Testing ncopn, ncinq, ncdinq, ncvinq, ncanam, ncainq ... > error in ncinq or ncddef > error in ncinq or ncvdef > make[1]: *** [test] Segmentation fault > make[1]: Leaving directory `/scsi/usr/src/netcdf-2.4-beta6/src/fortran' > make: *** [fortran/test] Error 1 > > > - ------------------------------------------------/ linux.m4 > divert(-1) > > # Name of system platform (for use in comments) > define(`M4__SYSTEM', 'linux PROMULA.FORTRAN') > # Using commercial PROMULA f2c-like translator with > # custom pf77 script by D. Ernst > > # transformation from fortran name to name of C module > define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore > > # transformation from string name to corresponding argument name > define(`STRINGF',`$1') > > # extra arguments, if any, for string length > define(`STRINGX',`, $1len') # one extra stringlen parameter > > # declaration to be used for argument name descriptor > define(`STRINGD',` > char *$1; `$2' > int $1`'`len';') # declare argument string with extra stringlen > parameter > > # declarations and initializations of canonical local variables > define(`STRINGL',`') > > # C integral type equivalent to a FORTRAN INTEGER > define(`F_INTEGER',`int') > > # FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft) > define(`LONG_INT',`integer*4') > > # FORTRAN declaration for a short integer (e.g. integer*2) > define(`SHORT_INT',`integer*2') > > # FORTRAN declaration for an integer byte (e.g. integer*1 or byte) > define(`BYTE_INT',`integer*1') > > # FORTRAN declaration for single precision > define(`SINGLE_PRECISION',`real') > > # FORTRAN declaration for double precision (e.g. real for a Cray) > define(`DOUBLE_PRECISION',`double precision') > > divert(0)dnl > > - ----------------------------------------------------\ What you did looks correct (though I'll need more information). We've never used a FORTRAN-to-C translator on the ftest.f program, so I'm currently leary of that. Would you please do the following: 1. Go to the fortran/ subdirectory. 2. Remove the following files: ftest, ftest.o, ftest.f. 3. Execute the command `make ftest.f'. Trap the output and send it to me. 4. Send me the file ftest.f. 5. Execute the command `make ftest.obj'. Trap the output and send it to me. -------- Steve Emmerson <address@hidden>