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.
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