NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20030826: compile netCDF using gfortran



Dumas,

> To: address@hidden
> From: Dumas Patrice <address@hidden>
> Subject: compile netcdf with gfortran
> Organization: ?
> Keywords: netCDF gfortran

The above message contained the following:

> I have a linux redhat 9.
> I am trying to compile netcdf with fortran 90, using gfortran.

I'm not aware of anyone ever using gfortran with the netCDF package.
g77 has been used, however.

> I found that
> compiler in the gcc CVS, in the tree-ssa-20020619-branch and installed
> it as explained on http://gcc-g95.sourceforge.net/.
> I use the gcc suite installed as part of the redhat 9 for the other
> languages.
> 
> It fails during make. Here are the commands I ran:
> $ export F90=/opt/data/dumas/gcc/bin/gfortran
> $ ./configure --prefix=/usr/local > configure.log 2>&1
> $  make > make.log 2>&1
> 
> Here are the informations requested for installation failure:
> 
> $ uname -a
> Linux zeus 2.4.20-18.9 #1 Thu May 29 07:08:16 EDT 2003 i686 i686 i386 
> GNU/Linux
> 
> $ cat VERSION
> 3.5.1-beta13
> 
> $ which c89
> /usr/bin/c89
> $ which c++
> /usr/bin/c++
> $ which f77
> /usr/bin/f77
> 
> I attached configure.log, make.log, macros.make, config.log.
> 
> Hope it helps !
> 
> Pat

> creating cache ./config.cache
> checking for top-level source-directory
> /opt/data/src/netcdf-3.5.1-beta13/src
> checking for m4 preprocessor
> checking for m4... m4
> checking m4 flags... -B10000
> checking for xlc... no
> checking for c89... c89
> checking C compiler "c89"... works
> checking how to make dependencies... false
> checking for CC... no
> checking for cxx... no
> checking for c++... c++
> checking C++ compiler "c++"... works
> checking how to run the C preprocessor... c89 -E
> checking "/opt/data/dumas/gcc/bin/gfortran" as Fortran-77 compiler... failed 
> to compile test program

It appears from the above that gfortran IS NOT a Fortran-77 compiler.

> checking for f77... f77
> checking for Fortran .F compiler... 
> checking if Fortran-77 compiler handles *.F files... yes
> checking user-defined Fortran-90 compiler 
> "/opt/data/dumas/gcc/bin/gfortran"... works

It appears from the above that gfortran IS a Fortran-90 compiler.

...
> Making `all' in directory /opt/data/src/netcdf-3.5.1-beta13/src/fortran
> 
> make[2]: Entre dans le r=E9pertoire `/cired/zeus/data/src/netcdf-3.5.1-beta=
> 13/src/fortran'
> c89 -c -O -I../libsrc  -DNDEBUG fort-attio.c
> Dans le fichier inclus =E0 partir de ncfortran.h:13,
>           =E0 partir de fort-attio.c:6:
> cfortran.h:134:3: #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.                                      - Al=
> pha VMS DEC C 1.3 and DEC FORTRAN 6.0.                               - Alph=
> a 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 SX-4 S=
> UPER-UX                                                      - CONVEX      =
>                                                            - Sun           =
>                                                          - PowerStation For=
> tran with Visual C++                                   - HP9000s300/s700/s8=
> 00 Latest test with: HP-UX A.08.07 A 9000/730        - LynxOS: cc or gcc wi=
> th f2c.                                            - VAXUltrix: vcc,cc or g=
> cc with f2c. gcc or cc with f77.                 -            f77 with vcc =
> works; but missing link magic for f77 I/O.     -            NO fort. None o=
> f gcc, cc or vcc generate required names.    - f2c    : Use #define    f2cF=
> ortran, or cc -Df2cFortran                 - NAG f90: Use #define NAGf90For=
> tran, or cc -DNAGf90Fortran              - Absoft UNIX F77: Use #define Abs=
> oftUNIXFortran or cc -DAbsoftUNIXFortran     - Absoft Pro Fortran: Use #def=
> ine AbsoftProFortran     - Portland Group Fortran: Use #define pgiFortran"
> make[2]: *** [fort-attio.o] Erreur 1
> make[2]: Quitte le r=E9pertoire `/cired/zeus/data/src/netcdf-3.5.1-beta13/s=
> rc/fortran'
> make[1]: *** [subdir_target] Erreur 1
> make[1]: Quitte le r=E9pertoire `/cired/zeus/data/src/netcdf-3.5.1-beta13/s=
> rc'
> make: *** [fortran/all] Erreur 2

The above indicates that the C compiler didn't know what Fortran
argument-passing conventions to use.  This information must be given to it
manually by defining a certain C macro in the CPPFLAGS environment
variable before executing the configure script.

Assuming that gfortran uses the same argument-passing conventions that
g77 uses (if it doesn't, then the "make test" will fail) then please try
the following:

    1.  Go to the top-level source directory.

    2.  Perform steps 3 through 5 described near the end of the file
        INSTALL.html.

    3.  Define the C macro "f2cFortran" in the environment variable
        CPPFLAGS:

            export CPPFLAGS=-Df2cFortran

        or

            setenv CPPFLAGS -Df2cFortran

        depending on your user-shell.

    4.  Perform steps 6 through 9 described near the end of the file
        INSTALL.html.

Regards,
Steve Emmerson