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 Jon, > When trying to compile a C++ program that is linking in libnetcdf.so.0, > I point my Makefile to /opt/local/lib (which is where the libraries were > installed). I can see the file there, but it gives the error message: > > "Error while loading shared libraries: libnetcdf.so.0: cannot open shared > object file : No such file or directory" This can occur for several reasons: - libnetcdf.so.0.0.0 might be a 32-bit library when your application needs 64-bit or vice-versa. You can determine this with the "file" command. - You may need to use libtool or specify LD_LIBRARY_PATH or LD_RUN_PATH or have the system library path configured to include /opt/local/lib. Here's the explanation and description of what to try from the output of "make install" when you're installing shared libraries: ---------------------------------------------------------------------- Libraries have been installed in: /opt/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- --Russ > We are using CentOS 5.5 with the NetCDF 4.1.2-beta 2 installed. > > Also, please see below for what is contained (partially) in /opt/local/lib: > > -rw-r--r-- 1 root root 1.3M Oct 1 2009 libnco.a > -rwxr-xr-x 1 root root 3.3M Oct 1 2009 libnco_c++-3.9.9.so > -rw-r--r-- 1 root root 1003K Oct 1 2009 libnco_c++.a > -rwxr-xr-x 1 root root 992 Oct 1 2009 libnco_c++.la > lrwxrwxrwx 1 root root 19 Oct 1 2009 libnco_c++.so -> libnco_c++-3.9.9.so > -rwxr-xr-x 1 root root 964 Oct 1 2009 libnco.la > lrwxrwxrwx 1 root root 15 Oct 1 2009 libnco.so -> libnco-3.9.9.so > -rw-r--r-- 1 root root 2.5M Mar 4 16:14 libnetcdf.a > -rw-r--r-- 1 root root 492K Mar 4 16:14 libnetcdf_c++.a > -rwxr-xr-x 1 root root 1.1K Mar 4 16:14 libnetcdf_c++.la > lrwxrwxrwx 1 root root 22 Mar 4 16:14 libnetcdf_c++.so -> > libnetcdf_c++.so.0.0.0 > lrwxrwxrwx 1 root root 22 Mar 4 16:14 libnetcdf_c++.so.0 -> > libnetcdf_c++.so.0.0.0 > -rwxr-xr-x 1 root root 345K Mar 4 16:14 libnetcdf_c++.so.0.0.0 > -rw-r--r-- 1 root root 793K Mar 4 16:14 libnetcdff.a > -rwxr-xr-x 1 root root 1.1K Mar 4 16:14 libnetcdff.la > lrwxrwxrwx 1 root root 19 Mar 4 16:14 libnetcdff.so -> libnetcdff.so.0.0.0 > lrwxrwxrwx 1 root root 19 Mar 4 16:14 libnetcdff.so.0 -> libnetcdff.so.0.0.0 > -rwxr-xr-x 1 root root 662K Mar 4 16:14 libnetcdff.so.0.0.0 > -rwxr-xr-x 1 root root 1.1K Mar 4 16:14 libnetcdf.la > lrwxrwxrwx 1 root root 18 Mar 4 16:14 libnetcdf.so -> libnetcdf.so.0.0.0 > lrwxrwxrwx 1 root root 18 Mar 4 16:14 libnetcdf.so.0 -> libnetcdf.so.0.0.0 > -rwxr-xr-x 1 root root 1.9M Mar 4 16:14 libnetcdf.so.0.0.0 > -rw-r--r-- 1 root root 48K Jul 1 2009 libv5d.a Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: LNM-552163 Department: Support netCDF Priority: Normal Status: Closed