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, > I am trying to link to the libraries to run the code. What module do I link > to? My code is in FORTRAN, and the following is what I use for compilation: > > gfortran -o nc nc.f95 -L/Users/Stefan/cool/lib -I/Users/Stefan/local/include > -I/Users/Stefan/cool/include -lhdf5 -lhdf5_hl -lz -lnetcdf It depends on whether you built shared libraries (the default) or static libraries (with the --disable-shared option to the configure script), as explained here, under the section "Linking your programs with netCDF Fortran libraries": http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html In either case, you need to use -lnetcdff, but with static libraries, you will also need -lnetcdf. > I am still unsure as to what commands and syntax I should be using. Before I > was using "use netcdf" to access the netcdf module, and it worked fine when I > used nf90_open to access the netcdf files. Now, I don't know if the syntax > is to change (i.e. using include 'netcdf.inc) thus changing the file open > syntax, or if things stay the same. I hope this makes sense. attached is a > SIMPLE version of my code (40 lines). You should still be able to use "use netcdf". The "netcdf.inc" file is for the old Fortran-77 API, which is still supported in the netCDF Fortran library. > To clarify, I was working with a netcdf library setup that did not use hdf5 > support previously, and I am now trying to work with a netcdf library setup > using zlib with hdf5 support. The linking to these libraries and the use of > syntax are very confusing. Yes, but it's less confusing if you use shared libraries, in which case the linking is straightforward. You can also use the command "nf-config" to provide necessary directories and flags, as in: gfortran -o test test.f90 `nf-config --fflags --flibs` or pkgconfig, if your platform supports it, as in export PKG_CONFIG_PATH=/opt/lib/pkgconfig # or whatever gfortran test.f90 -o test `pkg-config --cflags --libs netcdf-fortran` This latter is not tested as well, but it may be working ... --Russ > Thanks very much! > > -Stefan > > ________________________________________ > > Stefan Rahimi > address@hidden > School of Meteorology, The University of Oklahoma > NWC 5110 > (405) 325-3051 > > > > > > ________________________________________ > From: Unidata netCDF Support [address@hidden] > Sent: Wednesday, March 26, 2014 7:16 AM > To: Rahimi, Stefan R. > Cc: address@hidden > Subject: [netCDF #HBB-707489]: Error When Building NetCDF4.3.1 > > Hi Stefan, > > > I was building netcdf4 with HDF5 support, and I got the following error as > > I did the "make check install" after setting my CPPFLAGS and my LDFLAGS: > > > > Testing: Http Basic Authorization > > syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or > > SCAN_ERROR > > This is a known issue related to a change in our test server > configuration. We are still working on redirects to fix this for > existing releases, and the upcoming 4.3.2 release will also fix it by > pointing directly to our new test servers. So, the failure is on our > end, not yours. > > Until this gets fixed, you can complete testing and installation of > the netCDF C library and utilities by following these steps: > > 1. Run "make clean" in the top level directory of your source netCDF > source (or unpack the source again in a new source directory) > > 2. Run the "configure" script again, but this time add the following > option to whatever options you previously specified: > > --disable-dap-remote-tests > > 3. Run "make check" and verify that it now completes successfully. > > 4. Run "make install", or "sudo make install" if needed. > > That should get you past the problem with our test server and allow > the installation to complete successfully. Please let us know if > you encounter additional errors. > > --Russ > > > context: <html^><head><title>Apache Tomcat/7.0.52 - Error > > report</title><style><!--H1 > > {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} > > H2 > > {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} > > H3 > > {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} > > BODY > > {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B > > {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} > > P > > {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A > > {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> > > </head><body><h1>HTTP Status 401 - </h1><HR size="1" > > noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> > > <u></u></p><p><b>description</b> <u>This request requires HTTP > > authentication.</u></p><HR size="1" noshade="noshade"><h3>Apache > > Tomcat/7.0.52</h3></body></html> > > *** Fail: Http Basic Authorization: NetCDF: Malformed or inaccessible DAP > > DDS > > FAIL: t_auth > > ================================================ > > 1 of 11 tests failed > > Please report to address@hidden > > ================================================ > > make[4]: *** [check-TESTS] Error 1 > > make[3]: *** [check-am] Error 2 > > make[2]: *** [check-recursive] Error 1 > > make[1]: *** [check] Error 2 > > make: *** [check-recursive] Error 1 > > > > Can you please help me to figure out what is wrong? I built zlib, hdf5 > > (specifying the zlib location), then I tried to build netcdf. I got these > > errors, and I would very much like to get this working. > > > > Cheers, and thank you! > > -Stefan Rahimi > > > > ________________________________________ > > > > Stefan Rahimi > > address@hidden > > School of Meteorology, The University of Oklahoma > > NWC 5110 > > (405) 325-3051 > > > > > > > > > > > > > > Russ Rew UCAR Unidata Program > address@hidden http://www.unidata.ucar.edu > > > > Ticket Details > =================== > Ticket ID: HBB-707489 > Department: Support netCDF > Priority: Normal > Status: Closed > > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: HBB-707489 Department: Support netCDF Priority: Normal Status: Closed