NOTE: You do not need to compile LAPACK. Hardware-specific optimized versions have been installed on Proteus. This is a guide meant for Proteus systems administrators.
A comment by emhj on that blogspot post says:
For newer versions of LAPACK, setting -DBUILD_SHARED_LIBS=ON when calling cmake will also build shared libraries.
Example cmake command, assuming that ../lapack-3.5.0 is the relative path to the source code:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lapack-3.5.0 -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=ON ../lapack-3.5.0
As usual with cmake, can use "ccmake" to get a TUI to edit the various build options.
- Check the INSTALL subdirectory for examples.
This is based on the content from the link in the "See Also" section to serve as redundancy, since that link is from 2010, and could disappear. Also, the makefile structure of LAPACK has changed since then.
Files to be Modified
These three files have to be modified:
Add "-fPIC" to the following:
Optionally add "-pipe" to the following:
For convenience, define PREFIX:
Define new macro for the linker:
LINKER = gfortran
Define new macro for the shared library (adjust version):
LAPACKSOLIB = liblapack.so.3.8.0
Add the shared library as a new target:
all: ../$(LAPACKLIB) ../$(LAPACKSOLIB)
Add rule for building the shared library:
../$(LAPACKSOLIB): $(ALLOBJ) $(ALLXOBJ) $(DEPRECATED) $(LINKER) -shared -Wl,-soname,$@ -o $@ $^
Add rules to copy the generated shared library to the right places (makes use of PREFIX defined earlier):
install: all cp $(LAPACKSOLIB) $(PREFIX)/lib ln -s $(PREFIX)/lib/$(LAPACKSOLIB) $(PREFIX)/lib/liblapack.so.3.8 ln -s $(PREFIX)/lib/$(LAPACKSOLIB) $(PREFIX)/lib/liblapack.so.3 ln -s $(PREFIX)/lib/$(LAPACKSOLIB) $(PREFIX)/lib/liblapack.so cp *.a $(PREFIX)/lib mkdir -p $(PREFIX)/man cp -R DOCS/man/man3 $(PREFIX)/man