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 allbuilds 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.1If 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/ -lslatecor 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/libso you'd do
sudo make installTo run programs that are linked against a new shared library, you may additionally need to run
sudo ldconfigin order to update the dynamic linker cache.
2