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.
Hello, LIBS is a valid environmental variable used by the linker; this environmental variable is telling the linker to attempt to link against these libraries. From what you provided, it appears that the issue is the compiler and linker are not finding libnetcdf when it attempts to link. This can be controlled by setting the environment variable LDFLAGS="path to directory containing libnetcdf". It looks like you're working with WRF; I'm afraid I don't have any experience with WRF specifically, you might also reach out to the WRF maintainers to see if they can provide additional information. Have a great day, -Ward > Hi Folks, > > Was wondering if you could answer a question regarding the netCDF-Fortran > 4.5.2 install in the NETCDF build. > > Wanted to verify the LIBS command > It is in the document and I don't believe this is a valid csh command > > setenv LIBS="-lnetcdf -lz" believe it to be setenv LIBS "-lnetcdf -lz" > > my initial tests for fortran and c were fine > > error in the INSTALL is > ./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 > --disable-shared > configure: WARNING: unrecognized options: --disable-dap, --disable-netcdf-4 > configure: netCDF-Fortran 4.5.2 > checking build system type... x86_64-pc-linux-gnu > checking host system type... x86_64-pc-linux-gnu > checking target system type... x86_64-pc-linux-gnu > checking for a BSD-compatible install... /usr/bin/install -c > checking whether build environment is sane... yes > checking for a thread-safe mkdir -p... /usr/bin/mkdir -p > checking for gawk... gawk > checking whether make sets $(MAKE)... yes > checking whether make supports nested variables... yes > checking whether to enable maintainer-specific portions of Makefiles... no > configure: checking user options > checking whether make supports the include directive... yes (GNU style) > checking for gcc... gcc > checking whether the C compiler works... no > configure: error: in `/app/wrf/Build_WRF/LIBRARIES/netcdf-fortran-4.5.2': > configure: error: C compiler cannot create executables > > config.log > configure:3959: checking whether the C compiler works below is the error I am > getting with the install > configure:3981: gcc -I/app/wrf/Build_WRF/LIBRARIES/grib2/includecd > -L/app/wrf/Build_WRF/LIBRARIES/grib2/lib conftest.c -lnetcdf -lz >&5 > /usr/bin/ld: cannot find -lnetcdf > collect2: error: ld returned 1 exit status > configure:3985: $? = 1 > configure:4023: result: no > configure: failed program was: > | /* confdefs.h */ > > Test of fortran calling c worked > C function called by Fortran > Values are xx = 2.00 and ii = 1 > SUCCESS test 4 fortran calling c Ticket Details =================== Ticket ID: UWC-650183 Department: Support netCDF Priority: Normal Status: Closed =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.