0

I have compiled a source code and included proper library files in the LDFLAGS. However, as I want to run the binary, it says a specific libX.a is missing. If I add the library's path to the LD_LIBRARY_PATH, everything will be OK.

Is there any way to permanently include that file in the binary in order to eliminate the LD_LIBRARY_PATH step?

LDFLAGS=-L/export/apps/computer/scalapack -L/export/apps/computer/OpenBLAS-0.2.18
BLAS_LIBS=-lopenblas
SCALAPACK_LIBS=-lscalapack

COMP_LIBS=dc_lapack.a liblapack.a libblas.a
LIBS=$(SCALAPACK_LIBS) $(BLAS_LIBS) 

The output of ldd command, shows

# ./siesta
./siesta: error while loading shared libraries: libopenblas.so.0: cannot open shared object file: No such file or directory
# ldd siesta
    libopenblas.so.0 => not found
    ...

However,

# ls ../../../computer/OpenBLAS-0.2.18/libopenblas* -l
lrwxrwxrwx 1 root root       33 Jul 27 11:58 ../../../computer/OpenBLAS-0.2.18/libopenblas.a -> libopenblas_piledriverp-r0.2.18.a
-rw-r--r-- 1 root root 28091912 Jul 27 11:59 ../../../computer/OpenBLAS-0.2.18/libopenblas_piledriverp-r0.2.18.a
-rwxr-xr-x 1 root root 14912094 Jul 27 12:00 ../../../computer/OpenBLAS-0.2.18/libopenblas_piledriverp-r0.2.18.so
lrwxrwxrwx 1 root root       34 Jul 27 12:00 ../../../computer/OpenBLAS-0.2.18/libopenblas.so -> libopenblas_piledriverp-r0.2.18.so
lrwxrwxrwx 1 root root       34 Jul 27 12:00 ../../../computer/OpenBLAS-0.2.18/libopenblas.so.0 -> libopenblas_piledriverp-r0.2.18.so

Any idea?

mahmood
  • 23,197
  • 49
  • 147
  • 242

1 Answers1

0

You have three possibilities

  1. Link the siesta program static.

or i guess you are looking for:

  1. Install OpenBLAS libraries in a path, that is already in your LD_LIBRARY_PATH like /usr/local/lib

  2. Use -Wl,-R/path/to/OpenBLAS compiler flag

arved
  • 4,401
  • 4
  • 30
  • 53