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, > > a. Problem > I need to compile a model which requires netCDf libraries and I am a > total beginner on linux systems. (Actually, I installed ubuntu just to > compile the model). > I installed libnetcdf6 package from the ubuntu (11.04) software center. > > b. netCDF status > I used the command nc-config --all to see the paths of the libraries : > > This netCDF 4.1.1 has been built with the following features : > --cc -> gcc > --cflags -> -I/usr/include > --libs -> -L/usr/lib -lnetcdf > --cxx -> g++ > --fc gfortran > --fflags -> -g -02 -I/usr/include > --flibs -> -L/usr/lib -lnetcdff -lnetcdf > --hasf77 -> yes > --hasf90 -> yes > --prefix -> /usr > --includedir -> /usr/include > --version -> netCDF 4.1.1 > > c. What I need > The makefile of the model I want to compile requires : > > ################################################################ > ## Edit these three to indicate the path for the netcdf include > ## file 'netcdf.h', the name of the netcdf library file, and the > ## path to that library file. > ################################################################ > NETCDFINCDIR = /usr/include > NETCDFLIB = /usr/lib/ -lnetcdf > NETCDFLIBDIR = /usr/lib > > d. What I get when compiling the model > /usr/bin/ld: cannot find /usr/lib/: File format not recognized > collect2: ld returned exit status > make: *** model Error 1 > > Thank you for your support, > > Viêt. > > Is the package you are building a fortran package? There is a 32-bit mode and a 64-bit mode for compilers, frequently fortran compilers use the opposite convention from gcc. You need to find a way to make your program 32-bit if your library is 32-bit, and 64-bit otherwise. Use the unix "file" command to learn more. Good luck, Ed Ticket Details =================== Ticket ID: NMN-242593 Department: Support netCDF Priority: Normal Status: Closed