error while loading shared libraries: libnetcdff.so.6: cannot open shared object file: No such file or directory

Asked by Pengfei Ou on 2017-10-28

Hi all,

Finally, I successfully compiled the 4.1-b3 version of transiesta, and also installed the shipped netcdf4 package. When I run the transiesta, the error occurred and the information was shown as follows:

./transiesta: error while loading shared libraries: libnetcdff.so.6: cannot open shared object file: No such file or directory

I attached my arch.make file, and wish someone can help me.

Thanks a lot,
Pengfei

arch.make file (compiled through 1) mvapich2/1.9-intel 2) ifort_icc/15.0)

# Copyright (C) 1996-2016 The SIESTA group
# This file is distributed under the terms of the
# GNU General Public License: see COPYING in the top directory
# or http://www.gnu.org/copyleft/gpl.txt.
# See Docs/Contributors.txt for a list of contributors.
#
#-------------------------------------------------------------------
# arch.make file for gfortran compiler.
# To use this arch.make file you should rename it to
# arch.make
# or make a sym-link.
# For an explanation of the flags see DOCUMENTED-TEMPLATE.make

.SUFFIXES:
.SUFFIXES: .f .F .o .c .a .f90 .F90

SIESTA_ARCH = ifort

CC = mpicc
FPP =
FC = mpif90
MPI_INTERFACE = libmpi_f90.a
MPI_INCLUDE = .
FC_SERIAL = ifort

FFLAGS = -g -O2

AR = ar
RANLIB = ranlib

SYS = nag

SP_KIND = 4
DP_KIND = 8
KINDS = $(SP_KIND) $(DP_KIND)

LDFLAGS =

ARFLAGS_EXTRA=

FCFLAGS_fixed_f =
FCFLAGS_free_f90 =
FPPFLAGS_fixed_F =
FPPFLAGS_free_F90 =

BLAS_LIBS = -L/software/libraries/MKL/10.3/lib/intel64 -lmkl_intel_lp64 -lmkl_blas95_lp64
LAPACK_LIBS = -L/software/libraries/MKL/10.3/lib/intel64 -lmkl_sequential -lmkl_core
BLACS_LIBS = -L/software/libraries/MKL/10.3/lib/intel64 -lmkl_blacs_intelmpi_lp64
SCALAPACK_LIBS = -L/software/libraries/MKL/10.3/lib/intel64 -lmkl_scalapack_lp64

FPPFLAGS = -DFC_HAVE_FLUSH -DFC_HAVE_ABORT -DMPI

COMP_LIBS = libncdf.a libfdict.a

NETCDF_ROOT = /home/pfou/pfou/software/siesta-4.1-b3/Docs/build/netcdf/4.5.0
NETCDF_INCFLAGS = -I$(NETCDF_ROOT)/include
NETCDF_LIBS = -L$(NETCDF_ROOT)/lib -lnetcdff -lnetcdf
HDF5_ROOT = /home/pfou/pfou/software/siesta-4.1-b3/Docs/build/hdf5/1.8.18
HDF5_INCFLAGS = -I$(HDF5_ROOT)/include
HDF5_LIBS = -L$(HDF5_ROOT)/lib -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lz

OTHER_LIBS = -L/home/pfou/pfou/software/siesta-4.1-b3/Docs/build/zlib/1.2.11/lib -lz

LIBS = $(SCALAPACK_LIBS) $(BLACS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(NETCDF_LIBS) $(COMP_LIBS) $(OTHER_LIBS)
LIBS += $(HDF5_LIBS)

FPPFLAGS += -DCDF -DNCDF -DNCDF_4

DUMMY_FOX = --enable-dummy

# Dependency rules ---------
FFLAGS_DEBUG = -g -O2 # your appropriate flags here...
# The atom.f code is very vulnerable. Particularly the Intel compiler
# will make an erroneous compilation of atom.f with high optimization
# levels.
atom.o: atom.F
        $(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<
.c.o:
        $(CC) -c $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $<
.F.o:
        $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<
.F90.o:
        $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $<
.f.o:
        $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f) $<
.f90.o:
        $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90) $<

Question information

Language:
English Edit question
Status:
Solved
For:
Siesta Edit question
Assignee:
No assignee Edit question
Solved by:
Nick Papior
Solved:
2017-10-30
Last query:
2017-10-30
Last reply:
2017-10-28
Best Nick Papior (nickpapior) said : #1

Most probably you have the netcdf library installed in the OS, and hence when linking it sees the one you define, but when running the executable does not know where the shared library exists.

You have two possibilities:
1) Add the correct library paths to the LD_LIBRARY_PATH environment variable, or
2) Make a static link to the shared library, use -Wl,-rpath=<lib-path>

In either case, please search around for these two cases, there are plenty of information on the internet on how to use these.

Pengfei Ou (barneycavs) said : #2

Thanks, Nick. This actually solved my problem.

Pengfei Ou (barneycavs) said : #3

Thanks Nick Papior, that solved my question.