Dear all,
I am a beginner in compiling codes using netcdf and I am stuck with this
problem. Even though my code compiles, when I run it the following
message shows up:
./mycode: error while loading shared libraries: libnetcdff.so.6: cannot
open shared object file: No such file or directory
However, this library is there and it seems that I have linked the
libraries correctly as one can see the output of the ldd command (full
output see below):
username@location:~/path$ ldd ./mycode
libnetcdff.so.6 => /usr/lib/x86_64-linux-gnu/libnetcdff.so.6
(0x00007fd4356fd000)
I also added in my bashrc file the following command:
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/"
In my makefile I have the following lines:
NETCDF_INCLUDE = $(shell /usr/bin/nc-config --fflags)
NETCDF_LIB = $(shell /usr/bin/nc-config --flibs)
COMPILER = mpif90
COMPILER_LINKS = -L/usr/lib
Could someone please give me an idea of what to try next? The output of
nc-config --all gives:
username@location:~/path$ nc-config --all
This netCDF 4.4.1.1 has been built with the following features:
--cc -> /usr/bin/cc
--cflags -> -I/usr/include -I/usr/include/hdf5/serial
--libs -> -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf -lhdf5_hl -lhdf5
-lpthread -lsz -lz -ldl -lm -lcurl
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--has-fortran-> yes
--fc -> gfortran
--fflags -> -I/usr/include
--flibs -> -L/usr/lib -lnetcdff -fPIE -pie -Wl,-z,relro
-Wl,-z,now -lnetcdf -lnetcdf
--has-f90 -> no
--has-f03 -> yes
--has-dap -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-logging-> yes
--has-pnetcdf-> no
--has-szlib -> no
--prefix -> /usr
--includedir-> /usr/include
--libdir -> /usr/lib/x86_64-linux-gnu
--version -> netCDF 4.4.1.1
username@location:~/path$ ldd ./mycode
linux-vdso.so.1 (0x00007ffcd43f3000)
libnetcdff.so.6 => /usr/lib/x86_64-linux-gnu/libnetcdff.so.6
(0x00007fd4356fd000)
libnetcdf.so.11 => /usr/lib/x86_64-linux-gnu/libnetcdf.so.11
(0x00007fd43238e000)
libcurl-gnutls.so.4 =>
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 (0x00007fd43210f000)
libmpi_usempif08.so.20 =>
/usr/lib/x86_64-linux-gnu/libmpi_usempif08.so.20 (0x00007fd431ee0000)
libmpi_usempi_ignore_tkr.so.20 =>
/usr/lib/x86_64-linux-gnu/libmpi_usempi_ignore_tkr.so.20
(0x00007fd431cda000)
libmpi_mpifh.so.20 => /usr/lib/x86_64-linux-gnu/libmpi_mpifh.so.20
(0x00007fd431a83000)
libmpi.so.20 => /usr/lib/x86_64-linux-gnu/libmpi.so.20
(0x00007fd431790000)
libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3
(0x00007fd43146a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd431166000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007fd430f4f000)
libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0
(0x00007fd430d10000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007fd430af3000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd430754000)
libhdf5_serial_hl.so.100 =>
/usr/lib/x86_64-linux-gnu/libhdf5_serial_hl.so.100 (0x00007fd430530000)
libhdf5_serial.so.100 =>
/usr/lib/x86_64-linux-gnu/libhdf5_serial.so.100 (0x00007fd42ffc8000)
libsz.so.2 => /usr/lib/x86_64-linux-gnu/libsz.so.2 (0x00007fd42fdc5000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd42fbab000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd42f9a7000)
libnghttp2.so.14 => /usr/lib/x86_64-linux-gnu/libnghttp2.so.14
(0x00007fd42f781000)
libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0
(0x00007fd42f55f000)
librtmp.so.1 => /usr/lib/x86_64-linux-gnu/librtmp.so.1
(0x00007fd42f342000)
libssh2.so.1 => /usr/lib/x86_64-linux-gnu/libssh2.so.1
(0x00007fd42f116000)
libpsl.so.5 => /usr/lib/x86_64-linux-gnu/libpsl.so.5
(0x00007fd42ef08000)
libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6
(0x00007fd42ecd1000)
libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30
(0x00007fd42e938000)
libgssapi_krb5.so.2 =>
/usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007fd42e6ed000)
libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3
(0x00007fd42e413000)
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3
(0x00007fd42e1e0000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2
(0x00007fd42dfdc000)
liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2
(0x00007fd42ddcd000)
libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2
(0x00007fd42db7c000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd42d974000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fd42d771000)
libhwloc.so.5 => /usr/lib/x86_64-linux-gnu/libhwloc.so.5
(0x00007fd42d535000)
libopen-pal.so.20 => /usr/lib/x86_64-linux-gnu/libopen-pal.so.20
(0x00007fd42d283000)
libopen-rte.so.20 => /usr/lib/x86_64-linux-gnu/libopen-rte.so.20
(0x00007fd42cff8000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd435d94000)
libaec.so.0 => /usr/lib/x86_64-linux-gnu/libaec.so.0
(0x00007fd42cdf0000)
libunistring.so.0 => /usr/lib/x86_64-linux-gnu/libunistring.so.0
(0x00007fd42cad9000)
libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4
(0x00007fd42c8a4000)
libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10
(0x00007fd42c621000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20
(0x00007fd42c311000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0
(0x00007fd42c0ac000)
libidn.so.11 => /lib/x86_64-linux-gnu/libidn.so.11 (0x00007fd42be78000)
libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6
(0x00007fd42bc65000)
libkrb5support.so.0 =>
/usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007fd42ba59000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1
(0x00007fd42b855000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2
(0x00007fd42b63e000)
libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2
(0x00007fd42b423000)
libnuma.so.1 => /usr/lib/x86_64-linux-gnu/libnuma.so.1
(0x00007fd42b218000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7
(0x00007fd42b00e000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0
(0x00007fd42adfa000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6
(0x00007fd42abf1000)