M BUZZ CRAZE NEWS
// general

Problem in installing library from github

By Mia Morrison

Generally, while installing libraries like lapack, blas, I just run the makefile and then they get automatically installed. To link them with my gfortran compiler, gfortran -llapack or gfortran -lblas flags are enough to link them. But when I installed this slatec library using make, by giving the flag gfortran -lslatec, nothing happended and it gave error that cannot find slatec. How to install it properly?

This is the library.

1 Answer

The command

make FC=gfortran all

builds the libraries in a local lib/ directory:

$ ls lib/
libslatec.a libslatec-dbvp.a libslatec-sbvp.a libslatec.so libslatec.so.4 libslatec.so.4.1.1

If you want to link the library when building your own program, you will need to tell the compiler where to find it by supplying an additional library search path

gfortran . . . -L path/to/slatec/lib/ -lslatec

or copy the library/libraries to somewhere on the default library search path such as /usr/local/lib - the slatec Makefile provides an install target to do exactly that, as you can see by running make -n install

$ make -n install
install -d /usr/local/lib
install -m644 -t /usr/local/lib \ lib/libslatec.a lib/libslatec-dbvp.a lib/libslatec-sbvp.a
install -m755 -t /usr/local/lib lib/libslatec.so.4.1.1
cp -P lib/libslatec.so lib/libslatec.so.4 \ /usr/local/lib

so you'd do

sudo make install

To run programs that are linked against a new shared library, you may additionally need to run

sudo ldconfig

in order to update the dynamic linker cache.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy