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.
Phil, > To: address@hidden > From: Phil Austin <address@hidden> > Subject: g77 and netcdf3.3 > Organization: University of British Columbia > Keywords: 199705272220.QAA26782 In the above message, you wrote: > Hi, is there a simple patch to cfortran.h that would support > g77 instead of f2c for linux? I could install f2c and build, > but am not sure whether the library will then be compatible with > g77. Here are all the diagnostics mentioned in the INSTALL file: > > bash# uname -a > Linux curlew 2.0.27 #2 Tue May 6 17:57:24 PDT 1997 i686 (debian 1.3) > > <phil@curlew: netcdf-3.3/src> cat VERSION > 3.3 > > <phil@curlew: netcdf-3.3/src> head -1000 config.out make.out > ==> config.out <== > creating cache ./config.cache > checking for m4... m4 > checking user-defined C compiler "/usr/bin/cc" > checking C compiler... works > checking for how to make dependencies... false > checking for /usr/bin/c++... /usr/bin/c++ > checking C++ compiler "/usr/bin/c++"... works > checking user-defined FORTRAN compiler "/usr/bin/g77"... works > checking for math library > checking for -lc... no > checking for -lm... yes > checking FORTRAN-type equivalent to netCDF "byte"... byte > checking FORTRAN-type equivalent to C "signed char"... byte > checking FORTRAN fill-value for netCDF version 2 byte... -127 > checking FORTRAN-type equivalent to netCDF "short"... integer*2 > checking FORTRAN-type equivalent to C "short"... integer*2 > checking FORTRAN-type equivalent to netCDF "long"... integer*4 > checking FORTRAN-type equivalent to C "int"... integer > checking FORTRAN-type equivalent to netCDF "float"... real*4 > checking FORTRAN-type equivalent to C "float"... real*4 > checking FORTRAN-type equivalent to netCDF "double"... real*8 > checking FORTRAN-type equivalent to C "double"... real*8 > checking for ar... ar > checking for ranlib... ranlib > checking how to run the C preprocessor... /usr/bin/cc -E > checking for stdlib.h... yes > checking for sys/types.h... yes > checking for strerror... yes > checking for ftruncate... yes > checking for st_blksize in struct stat... yes > checking whether cross-compiling... no > checking for IEEE floating point format... yes > checking for ANSI C header files... yes > checking for size_t... yes > checking for off_t... yes > checking for ssize_t... yes > checking for ptrdiff_t... yes > checking for uchar... no > checking whether char is unsigned... no > checking whether byte ordering is bigendian... no > checking size of short... 2 > checking size of int... 4 > checking size of long... 4 > checking size of float... 4 > checking size of double... 8 > checking size of off_t... 4 > checking size of size_t... 4 > checking for command to create manual-page index... > checking binary distribution directory... /home/ftp/pub/binary/dummy_system > updating cache ./config.cache > creating ./config.status > creating macros.make > creating libsrc/ncconfig.h > libsrc/ncconfig.h is unchanged > creating fortran/netcdf-cpp.inc > fortran/netcdf-cpp.inc is unchanged > > ==> make.out <== > make[1]: Entering directory `/homes/datatmp/netcdf-3.3/src' > > Making `all' in directory /homes/datatmp/netcdf-3.3/src/libsrc > > make[2]: Entering directory `/homes/datatmp/netcdf-3.3/src/libsrc' > /usr/bin/cc -c -O -I. -DNDEBUG attr.c > /usr/bin/cc -c -O -I. -DNDEBUG dim.c > /usr/bin/cc -c -O -I. -DNDEBUG error.c > /usr/bin/cc -c -O -I. -DNDEBUG -DVERSION=`cat ../VERSION` libvers.c > /usr/bin/cc -c -O -I. -DNDEBUG nc.c > /usr/bin/cc -c -O -I. -DNDEBUG ncio.c > /usr/bin/cc -c -O -I. -DNDEBUG ncx.c > /usr/bin/cc -c -O -I. -DNDEBUG putget.c > /usr/bin/cc -c -O -I. -DNDEBUG string.c > /usr/bin/cc -c -O -I. -DNDEBUG v1hpg.c > /usr/bin/cc -c -O -I. -DNDEBUG v2i.c > /usr/bin/cc -c -O -I. -DNDEBUG var.c > ar cru libnetcdf.a attr.o dim.o error.o libvers.o nc.o ncio.o ncx.o > putget.o string.o v1hpg.o v2i.o var.o > ranlib libnetcdf.a > m4 -B7168 -DAPI=C ../man/netcdf.m4 >netcdf.3 || rm netcdf.3 > make[2]: Leaving directory `/homes/datatmp/netcdf-3.3/src/libsrc' > > Returning to directory /homes/datatmp/netcdf-3.3/src > > make[1]: Leaving directory `/homes/datatmp/netcdf-3.3/src' > make[1]: Entering directory `/homes/datatmp/netcdf-3.3/src' > > Making `all' in directory /homes/datatmp/netcdf-3.3/src/nc_test > > make[2]: Entering directory `/homes/datatmp/netcdf-3.3/src/nc_test' > /usr/bin/cc -c -O -I../libsrc -DNDEBUG nc_test.c > /usr/bin/cc -c -O -I../libsrc -DNDEBUG error.c > /usr/bin/cc -c -O -I../libsrc -DNDEBUG test_get.c > /usr/bin/cc -c -O -I../libsrc -DNDEBUG test_put.c > /usr/bin/cc -c -O -I../libsrc -DNDEBUG test_read.c > /usr/bin/cc -c -O -I../libsrc -DNDEBUG test_write.c > /usr/bin/cc -c -O -I../libsrc -DNDEBUG util.c > /usr/bin/cc -o nc_test -O nc_test.o error.o test_get.o test_put.o > test_read.o test_write.o util.o -L../libsrc -lnetcdf -lm > make[2]: Leaving directory `/homes/datatmp/netcdf-3.3/src/nc_test' > > Returning to directory /homes/datatmp/netcdf-3.3/src > > make[1]: Leaving directory `/homes/datatmp/netcdf-3.3/src' > make[1]: Entering directory `/homes/datatmp/netcdf-3.3/src' > > Making `all' in directory /homes/datatmp/netcdf-3.3/src/fortran > > make[2]: Entering directory `/homes/datatmp/netcdf-3.3/src/fortran' > sed 's/@FILBYTE@/-127/g' \ > netcdf.in >netcdf.inc > /usr/bin/cc -c -O -I../libsrc -DNDEBUG fort-attio.c > make[2]: Leaving directory `/homes/datatmp/netcdf-3.3/src/fortran' > make[1]: Leaving directory `/homes/datatmp/netcdf-3.3/src' > > In file included from ncfortran.h:13, > from fort-attio.c:5: > cfortran.h:151: #error "cfortran.h: Can't find your environment among: - > MIPS cc and f77 2.0. (e.g. Silicon Graphics, DECstations, ...) - IBM > AIX XL C and FORTRAN Compiler/6000 Version 01.01.0000.0000 - VAX > VMS CC 3.1 and FORTRAN 5.4. - Alpha VMS > DEC C 1.3 and DEC FORTRAN 6.0. - Alpha OSF DEC > C and DEC Fortran for OSF/1 AXP Version 1.2 - Apollo DomainOS > 10.2 (sys5.3) with f77 10.7 and cc 6.7. - CRAY > - NEC SUPER-UX (SX) > - CONVEX > - Sun > - PowerStation Fortran with Visual C++ > - HP9000s300/s700/s800 Latest test with: HP-UX > A.08.07 A 9000/730 - LynxOS: cc or gcc with f2c. ! > - VAXUltrix: vcc,cc or gcc with f2c. gcc or > cc with f77. - f77 with vcc works; but missing > link magic for f77 I/O. - NO fort. None of gcc, cc or vcc > generate required names. - f2c : Use #define f2cFortran, or cc > -Df2cFortran - NAG f90: Use #define NAGf90Fortran, or cc > -DNAGf90Fortran - Absoft UNIX F77: Use #define AbsoftUNIXFortran > or cc -DAbsoftUNIXFortran" > make[2]: *** [fort-attio.o] Error 1 > make[1]: *** [subdir_target] Error 1 > make: *** [fortran/all] Error 2 > 41.150u 1.920s 0:44.98 95.7% 0+0k 0+0io 17232pf+0w Hmm... To answer your question definitively, I would have to know what the g77-to-gcc calling conventions are -- and I don't. On the assumption that they are the same as the f2c-to-gcc calling conventions, I suggest trying the following: 1. Go to the top-level source directory of the netCDF-3 package. 2. Execute the command "make distclean". 3. Ensure that the file "config.cache" has been removed. 4. Include "-Df2cFortran" in the setting of the environment variable CPPFLAGS, e.g. CPPFLAGS='-Df2cFortran -DNDEBUG' 5. Execute the configure script. 6. Execute the command "make". Another value that you might try in step 4 above is "sunFortran". Please let me know if this helps. -------- Steve Emmerson <address@hidden>