Kensuke, > I tinkered around with the netCDF more after I sent the email, and the error > message has changed since, but here goes what it says now > > > After building netcdf-fortran-4.2 and before installing it, did you run > > "make check"? > > Did it succeed with all its tests? If not, we'll need more information > > about any > > tests that didn't work. > > > > first, I ran the "make check" command on netcdf-4.2.1.1 and here are the test > results > > make check-TESTS > > make[2]: Entering directory `/home/ken/Downloads/netcdf-4.2.1.1/h5_test' > > ./tst_h_files: error while loading shared libraries: libhdf5_hl.so.7: cannot > open shared object file: No such file or directory > > FAIL: tst_h_files > > ./tst_h_files2: error while loading shared libraries: libhdf5_hl.so.7: cannot > open shared object file: No such file or directory Could you try running export LD_LIBRARY_PATH=/usr/local/lib before running "make check" to see if that makes a difference. It ought to be enough to set LD_LIBRARY_PATH before the configure command, but it will at least tell us whether the problem is just related to finding the shared libraries. Also, make sure you have used the same C compiler for the same architecture (32-bit or 64-bit) that you used to build and install the HDF5 libraries. For example, if those were built for 32-bit and you are compiling the netCDF libraries for 64-bit, the hdf5 libraries won't be found when needed by netCDF. Another possible problem is older copies of the HDF5 or netCDF shared libraries stored in /usr/lib or /lib or other directories where they might be linked at run-time, before /usr/local/lib is searched. If your system has previous versions installed, use the "ldd" command to see if they are being found and used first, e.g. ldd /usr/local/bin/ncdump should show where all the shared libraries used by the ncdump utility are coming from. If the above doesn't help, I can only suggest starting from scratch and sending us the output from configure, the entire config.log file created in the build directory, and the output from "make check" and "make install". > libhdf5_hl.so.7 file is located in usr/local/lib/ > the compile command I used for this is > > LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include > LD_LIBRARY_PATH=/usr/local/lib ./configure --enable-netcdf-4 --enable-dap > --enable-shared âprefix=/usr/local > > > next, the netcdf-fortran-4.2 The netCDF C library must be properly installed and working before the netCDF Fortran library can be built and installed. > > make > check-TESTS > > make[2]: > Entering directory `/home/ken/Downloads/netcdf-fortran-4.2/nf_test' > > /home/ken/Downloads/netcdf-fortran-4.2/nf_test/.libs/lt-nf_test: > error while loading shared libraries: libnetcdf.so.7: cannot open > shared object file: No such file or directory > > FAIL: > nf_test > > *** > Copying file with fill values. > > *** > SUCCESS! > > PASS: > create_fills.sh > > /home/ken/Downloads/netcdf-fortran-4.2/nf_test/.libs/lt-tst_f77_v2: > error while loading shared libraries: libnetcdf.so.7: cannot open > shared object file: No such file or directory > > FAIL: > tst_f77_v2 > > /home/ken/Downloads/netcdf-fortran-4.2/nf_test/.libs/lt-ftst_vars: > error while loading shared libraries: libnetcdf.so.7: cannot open > shared object file: No such file or directory > > FAIL: > ftst_vars > > /home/ken/Downloads/netcdf-fortran-4.2/nf_test/.libs/lt-ftst_vars2: > error while loading shared libraries: libnetcdf.so.7: cannot open > shared object file: No such file or directory > > FAIL: > ftst_vars2 > > : > : > : > /home/ken/Downloads/netcdf-fortran-4.2/nf_test/.libs/lt-ftest: > error while loading shared libraries: libnetcdf.so.7: cannot open > shared object file: No such file or directory > > FAIL: > ftest > > /home/ken/Downloads/netcdf-fortran-4.2/nf_test/.libs/lt-tst_f90: > error while loading shared libraries: libnetcdf.so.7: cannot open > shared object file: No such file or directory > > FAIL: > tst_f90 > > ================================================ > > 26 > of 27 tests failed > > Please > report to address@hidden > > ================================================ > > > again, libnetcdf.so.7 is found in usr/local/lib/the compile command I used was ... > > LDFLAGS=-L/usr/local/lib > CPPFLAGS=-I/usr/local/include LD_LIBRARY_PATH=/usr/local/lib > ./configure --prefix=/usr/local Again, try setting LD_LIBRARY_PATH to include /usr/local/lib before running "make check". > > In particular, look at the output of > > > > nf-config --fflags --flibs > I'm not sure if this will help, but the results of the nc-config --all was > > --cc > -> gcc > > --cflags > -> -I/usr/local/include -I/usr/local/include > > --libs > -> -L/usr/local/lib -lnetcdf > > > > --has-c++ > -> no > > --cxx > -> > > --has-c++4 > -> no > > --cxx4 > -> > > > > --fc > -> > > --fflags > -> > > --flibs > -> > > --has-f90 > -> no Those would all report nothing or "no" before the Fortranlibraries are installed. > --has-dap > -> yes > > --has-nc2 > -> yes > > --has-nc4 > -> yes > > --has-hdf5 > -> yes > > --has-hdf4 > -> no > > --has-pnetcdf-> > no > > --has-szlib > -> > > > > --prefix > -> /usr/local > > --includedir-> > /usr/local/include > > --version > -> netCDF 4.2.1.1 That all looks good, as does the output you sent from nf-config --all. > I've played around with --fc to make it ifort, but that did not solve the > problem... though it changed the error message when I try compiling the > fortran program. The default configuration seems to be in gfortran > > the error message with the noahLSM now says > > module_io.f(5): error #7013: This module file was not generated by any > release of this compiler. [NETCDF] > use module_netcdf_io > ------^ > compilation aborted for module_io.f (code 1) "netcdf_io" is not the name of the Fortran-90 module built by the netCDF-fortran-4.2 library, it's just "netcdf". Are netcdf_io.f and module_io.f part of noahLSM? You will definitely have to use the same Fortran compiler for building the netCDF-Fortran library as you use for programs the call netCDF, such as noahLSM. Different Fortran compilers typically have different formats for module files like netcdf.mod, and don't understand module files created by other Fortran compilers. --Russ > > To: address@hidden > > Subject: [netCDF #LPX-911763]: problem compiling, undefined reference > > Date: Mon, 11 Feb 2013 10:28:52 -0700 > > CC: address@hidden > > From: address@hidden > > > > Hi Kensuke, > > > > > > > If those tests worked and "make install" installed the netCDF library in > > /usr/local/lib, > > are you able to build one of the example Fortran programs from the source > > distribution, > > for example netcdf-fortran-4.2/examples/F77/simple_xy_wr.f ? To do this, > > it will help > > to look at the output of the nf-config program, that should have been > > installed in > > /usr/local/lib/bin/, if /usr/local/lib is where you installed > > netcdf-fortran. > > > > > > > and try using that in your compile command. If the library was installed > > as shared, but > > you may also need to add the location of the shared library to your > > LD_LIBRARY_PATH so > > the run-time loader can find it. > > > > As an example, I have the netcdf-4.2.1.1 C library installed in > > /usr/local and I specified --prefix=/usr/local for where to install > > the netcdf-fortran-4.2 libraries (--prefix=/usr/local/ is the default, > > so I could have omitted it). > > > > I then built the netCDF-fortran libraries with > > > > LD_LIBRARY_PATH=/usr/local/lib LDFLAGS=-L/usr/local/lib > > CPPFLAGS=-I/usr/local/include ./configure --prefix=/usr/local > > > > Then I ran "make check" to make sure the library worked, and "make > > install" to install the netcdf-fortran libraries in /usr/local. > > > > Then the output of > > > > /usr/local/bin/nf-config --fflags --flibs > > > > was > > > > -g -O2 -I/usr/local/include > > -L/usr/local/lib -lnetcdff -L/usr/local/lib -lnetcdf -lnetcdf > > > > (the extra -lnetcdf on the end is a harmless bug). > > > > Then I compile the example program simple_xy_wr.f using those flags like > > this: > > > > gfortran simple_xy_wr.f -o simple_xy_wr `/usr/local/bin/nf-config > > --fflags --flibs` > > > > Then I ran the resulting program, after setting the LD_LIBRARY_PATH to > > where the libraries > > were installed, because otherwise the operating system only looks in > > standard places like > > /usr/lib: > > > > export LD_LIBRARY_PATH=/usr/local/lib > > ./simple_xy_wr > > > > and the output was > > > > *** SUCCESS writing example file simple_xy.nc! > > > > --Russ > > > > > My brief search told me to add -lnetcdff to the NETCDFLIB, but that did > > > not solve the problem. The location of NETCDFLIB is correct, unless I > > > am looking at a wrong file (user_build_options in noahLSM). > > > > > > Ken > > > > > > > > Russ Rew UCAR Unidata Program > > address@hidden http://www.unidata.ucar.edu > > > > > > > > Ticket Details > > =================== > > Ticket ID: LPX-911763 > > Department: Support netCDF > > Priority: Normal > > Status: Closed > > > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: LPX-911763 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.