Compiling Slatec on macOS

# SLATEC Common Mathematical Library, Version 4.1, July 1993
# a comprehensive software library containing over
# 1400 general purpose mathematical and statistical routines
# written in Fortran 77.

If you want to install SLATEC, you need to make sure to install gfortran.

Take a look here for a brief instructions, somewhere in the middle of shell code: http://www.owsiak.org/?p=3492

Make sure to download sources and linux makefile and put all files at the same level. By saying at the same level, I mean that all *.f files from slatec_src.tgz and makefile and dynamic and static from slatec4linux.tgz are in the same dir.

SLATEC sources: http://www.netlib.org/slatec/slatec_src.tgz
SLATEC makefile: http://www.netlib.org/slatec/slatec4linux.tgz

Before building library, make sure to export FC variable (it is needed by makefile)

export FC=gfortran

Make sure to change this line inside dynamic/makefile

libslatec.so: $(OBJ)
    $(CC) -shared -o $@ $(OBJ)

to

libslatec.so: $(OBJ)
    $(FC) -shared -o $@ $(OBJ)

Call make

make

Wait a little bit. Take a look inside static and dynamic, files should be there.

find . -name "libslatec*"
./dynamic/libslatec.so
./static/libslatec.a

Now, you can try to perform make install (pay attention here as it will overwrite hardcoded locations). Alternatively, you can use

-L${WHERE_YOUR_BUILD_WAS_DONE}/dynamic -lslatec

SLATEC refers to symbols that can be found inside LAPACK package. If you don’t have it installed, take a look here

mkdir lapack
cd lapack
curl "http://www.netlib.org/lapack/lapack-3.7.1.tgz" -o lapack-3.7.1.tgz
tar zxf lapack-3.7.1.tgz
cd lapack-3.7.1
ln -s make.inc.example make.inc
make

After compilation is done, you can find liblapack.a inside lapack-3.7.1.

Leave a comment

Your comment