URL to SGESV documentation https://www.netlib.org/lapack/explore-html/d8/da6/group__gesv_ga5ac9906b2a7bca68858dfe016552afde.html#ga5ac9906b2a7bca68858dfe016552afde After downloading the LAPACK library source via wget http://www.netlib.org/lapack/lapack-3.7.0.tgz I followed the instructions in the README file and used make to compile the lapack libraries. I needed to compile the BLAS routines (included in another directory), also with make. One can either include the libraries explicitly in the compilation, gfortran testSGESV.f90 lapack-3.7.0/lib*.a or tell the compiler where to look for the libaries (with -L) and which libraries to use (-l) gfortran testSGESV.f90 -L./lapack-3.7.0 -llapack -lrefblas Note that the libraries are useless to you unless they are compiled/installed! UPDATE: LAPACK has been installed on alfven, so I now can compile with gfortran testSGESV.f90 /usr/lib64/liblapack.so.3.6.1 or gfortran testSGESV.f90 -l:liblapack.so.3 -llapack won't work because by default linker searches for "liblapacke.so" On macos, use: gfortran testSGESV.f90 -framework accelerate Compiling C code on Alfven: gcc test-COL.c -I. -o test-COL /usr/lib64/liblapacke.so.3 gcc test-ROW.c -I. -o test-ROW /usr/lib64/liblapacke.so.3 or gcc test-ROW.c -I. -o test-ROW -l:liblapacke.so.3 gcc test-ROW.c -I. -o test-ROW -llapacke (won 't work because by default linker searches for "liblapacke.so", not "liblapacke.so.3") What I used on my Mac gcc test-ROW.c -o testROW -I. -L/Users/saika/COURSES/P3800-stuff/LAPACK/lapack-3.7.0 -llapacke -llapack -lrefblas -L/usr/local/gfortran/lib/ -lgfortran or after using brew install lapack gcc -I/usr/local/opt/lapack/include -L/usr/local/opt/lapack/lib test-COL.c -llapack -llapacke Steps for installing wget http://www.netlib.org/lapack/lapack-3.8.0.tar.gz tar -zxf lapack-3.8.0.tar.gz cd lapack-3.8.0/ (explore) less README.md ls INSTALL cp make.inc.example make.inc less Makefile time make (real 7m43.916s) cd LAPACKE make time make (real 5m2.832s) cd .. ls lib* liblapack.a liblapacke.a librefblas.a libtmglib.a Install on Ubuntu sudo apt-get install libblas-dev liblapack-dev Afterwards, you should be able to compile with gfortran testSGESV.f90 -llapack google install mkl (Intel Math Kernel Library)