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

[netCDF #FQG-785243]: problems on cygwin platform



Hi Xueming,

> I have installed it successfully follow your suggestion.But I'm
> sorry to tell you that I can compile nf90 source code, but can't compile
> nf code with it, even if I configure it with 'F77=95'. However, I can
> compile the nf(fortran 77) code with gfortran. Can you tell me what's
> the reason for that?

I'm not sure, but did you run "make check" after building the library
and before installing it?  If so, it should have tested the F77 interface,
and you should have seen output like this from "make check":

   *** Testing netCDF-3 Fortran 77 API.
   NetCDF version: "4.0.1" of Feb 15 2012 06:36:29 $                            
                   
   *** testing nf_strerror ... 
   *** testing nf_open ... 
   *** testing nf_close ... 
   *** testing nf_inq ... 

... lots of other tests ...

   *** testing nf_del_att ... 
   *** testing nf_set_fill ... 
   *** testing nf_set_default_format ... 
   Total number of failures:            0
   *** SUCCESS!
  PASS: nf_test

    *** Testing netCDF v2 api for F77.
    *** SUCCESS!
  PASS: tst_f77_v2

If those tests worked, then you should be able to use the same compile
and linker flags to compile successfully.  You could see what flags
were used for the tests by doing

  cd nftest
  rm nf_test.o nf_test
  make nf_test

You might have two separate libraries installed, for the Fortran and C 
libraries, in which case you will have to link with two library flags, 
such as

  ... -lnetcdff -lnetcdf

Note that g95 and gfortran use different conventions for calling C
functions from Fortran, so you should not expect to be able to build
the library with one compiler, such as gfortran, and then compile and
link applications with a different Fortran compiler, such as g95.  You
should use the same Fortran compiler for netCDF client applications 
that you used to build the library.

We have a newer netCDF Fortran library that uses the Fortran-2003 C
interoperability features to support standard ways of calling C from
Fortran, so that different compilers that conform to Fortran-2003
could be used to build the library and later to build applications
that call the library, but using that requires upgrading your code
to use

  netcdf-fortran-4.4-beta1.tar.gz

with netCDF-4.2.1.1 or later.

--Russ

> 2013/6/13 6:19, Unidata netCDF Support ?:
> > Hi Xueming Zhu,
> >
> > Could you try rebuilding this way:
> >
> > CC=gcc FC=g95 CPPFLAGS=-DpgiFortran FFLAGS=-fno-second-underscore 
> > FCFLAGS=-fno-second-underscore ./configure --prefix=/usr/local/netcdf-4.0.1
> > make
> > make check
> > make install
> >
> > I think the "-fno-second-underscore flag may be needed for g95 builds
> > on CYGWIN.
> >
> > Also I don't think ther should be any "*" in your
> > --prefix=/usr/local/netcdf-4.0.1/* option.
> >
> > --Russ
> >
> >> I have tried to compile netCDF on my cygwin platform
> >> (CYGWIN_NT-6.1-WOW64 zhuxm-PC 1.7.20(0.266/5/3) 2013-06-07 11:11 i686
> >> Cygwin), I have installed g95 and gfortran compilers on it.My laptop is
> >> WIN7 64bits OS. Although I have configured and install successfully
> >> *(please see attchaed file config.log and make_install.txt)*, got couple
> >> problems as follow:
> >>
> >> (1) I have got some error messages during 'make check', please see
> >> attached file *error_message_make_test.txt*
> >>
> >> (2) I have configured it with command '*CPPFLAGS=-DpgiFortran
> >> ./configure --prefix=/usr/local/netcdf-4.0.1/*' successful, then I type
> >> the command 'nc-config --all' got the result as follow:
> >> *zhuxm@zhuxm-PC /netcdf-4.0.1**
> >> **$ nc-config --all**
> >> **
> >> **This netCDF 4.0.1 has been built with the following features:**
> >> **
> >> **  --cc        -> cc**
> >> **  --cflags    ->  -I/usr/local/netcdf-4.0.1/include**
> >> **  --libs      -> -L/usr/local/netcdf-4.0.1/lib -lnetcdf**
> >> **
> >> **  --cxx       -> g++**
> >> **  --has-c++   -> yes**
> >> **
> >> **  --fc        -> g95**
> >> **  --fflags    -> -g -O2 -I/usr/local/netcdf-4.0.1/include**
> >> **  --flibs     -> -L/usr/local/netcdf-4.0.1/lib -lnetcdf**
> >> **  --has-f77   -> yes**
> >> **  --has-f90   -> yes**
> >> **
> >> **  --has-dap   -> no**
> >> **  --has-nc2   -> yes**
> >> **  --has-nc4   -> no**
> >> **  --has-hdf5  -> no**
> >> **
> >> **  --prefix    -> /usr/local/netcdf-4.0.1**
> >> **  --version   -> netCDF 4.0.1**
> >> *I think this means that netCDF had been compiled with g95 compiler, is
> >> it correct? But one strange thing was when I compiled my source fortran
> >> code, which use nf interface(nf_open), with g95 compiler, I got the
> >> error message as follow:
> >>
> >> *zhuxm@zhuxm-PC /cygdrive/e/GDEMV3**
> >> **$ g95 read_interpolate.f90 -I/usr/local/netcdf-4.0.1/include -lnetcdf
> >> -L/usr/loc    al/netcdf-4.0.1/lib -o rea1**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x836): undefined
> >> reference to `nf_o    pen__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x872): undefined
> >> reference to `nf_i    nq_dimid__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x8a8): undefined
> >> reference to `nf_i    nq_dimlen__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x9c0): undefined
> >> reference to `nf_i    nq_varid__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x9f6): undefined
> >> reference to `nf_g    et_var_real__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0xcb5): undefined
> >> reference to `nf_i    nq_varid__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0xceb): undefined
> >> reference to `nf_g    et_var_real__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0xe13): undefined
> >> reference to `nf_c    lose__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x1428): undefined
> >> reference to `nf_    open__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x1482): undefined
> >> reference to `nf_    open__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x14e3): undefined
> >> reference to `nf_    inq__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x157a): undefined
> >> reference to `nf_    inq_dim__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x15a2): undefined
> >> reference to `nf_    inq_dimlen__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x167f): undefined
> >> reference to `nf_    inq_varid__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x16a7): undefined
> >> reference to `nf_    get_var_double__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x1789): undefined
> >> reference to `nf_    inq_varid__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x17b1): undefined
> >> reference to `nf_    get_var_double__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x1893): undefined
> >> reference to `nf_    inq_varid__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x18bb): undefined
> >> reference to `nf_    get_var_double__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x274e): undefined
> >> reference to `nf_    inq_varid__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x278a): undefined
> >> reference to `nf_    get_vara_real__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x2e1b): undefined
> >> reference to `nf_    inq_varid__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x2e57): undefined
> >> reference to `nf_    get_vara_real__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x5234): undefined
> >> reference to `nf_    close__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x5248): undefined
> >> reference to `nf_    close__'**
> >> **/tmp/ccNOG50I.o:read_interpolate.f90:(.text+0x75d7): undefined
> >> reference to `nf_    strerror__'**
> >> **/bin///ld: /tmp/ccNOG50I.o: bad reloc address 0x0 in section `.data'**
> >> **/bin///ld: final link failed: Invalid operation*
> >>
> >> But when I compiled it with gfortran compiler, it worked well,
> >> *zhuxm@zhuxm-PC /cygdrive/e/GDEMV3**
> >> **$ gfortran read_interpolate.f90 -I/usr/local/netcdf-4.0.1/include
> >> -lnetcdf -L/us r/local/netcdf-4.0.1/lib -o rea1**
> >> **
> >> **zhuxm@zhuxm-PC /cygdrive/e/GDEMV3**
> >> *
> >> (3) When I compiled my source foran code, which use nf90 interface,
> >> I have got some error messages as follow:
> >> *zhuxm@zhuxm-PC /cygdrive/e/GDEMV3**
> >> **$ gfortran read_interpolate_nf90.f90 -I/usr/local/netcdf-4.0.1/include
> >> -lnetcdf***(f)* -L/usr/local/netcdf-4.0.1/lib -o rea1**
> >> **read_interpolate_nf90.f90:5.11:**
> >> **
> >> ** use netcdf**
> >> **           1**
> >> **Fatal Error: File 'netcdf.mod' opened at (1) is not a GFORTRAN module
> >> file*
> >>
> >> and
> >> *zhuxm@zhuxm-PC /cygdrive/e/GDEMV3**
> >> **$ gfortran read_interpolate_nf90.f90 -I/usr/local/netcdf-4.0.1/include
> >> -lnetcdf(f) -L/usr/local/netcdf-4.0.1/lib -o rea1**
> >> **read_interpolate_nf90.f90:5.11:**
> >> **
> >> ** use netcdf**
> >> **           1**
> >> **Fatal Error: File 'netcdf.mod' opened at (1) is not a GFORTRAN module
> >> file*
> >>
> >> Could you help me to figure out those problem? I just want to use it
> >> to compile source fortran file with nf90 interface.
> >> Hopefully you can help me.
> >> Regards.
> >>
> >> --
> >> Xueming Zhu ?
> >> Key Laboratory of Research on Marine Hazards Forecasting(LoMF),SOA
> >> National Marine Environmental Forecasting Center(NMEFC)
> >> No.8, Dahuisi Road, Haidian District, Beijing , 100081
> >> People's Republic of China
> >> Tel:+86-10-82481923
> >>
> >>
> >>
> > Russ Rew                                         UCAR Unidata Program
> > address@hidden                      http://www.unidata.ucar.edu
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: FQG-785243
> > Department: Support netCDF
> > Priority: Normal
> > Status: Closed
> >
> >
> >
> 
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: FQG-785243
Department: Support netCDF
Priority: Normal
Status: Closed