Use Intel MKL LAPACK95 with Gfortran

Here’s how to build the Intel MKL LAPACK95 library for use with gfortran. You can also use Netlib LAPACK95 instead of Intel MKL LAPACK95.

This procedure assumes environment variable


is a non-blank value such as:


If $MKLROOT is blank, try to find where Intel MKL is on your system (did you install Intel MKL yet?)

Build / Install: MKL LAPACK95

We install MKL (without sudo) to your project’s directory. Here we assume your project is in ~/myproject.

cd $MKLROOT/interfaces/lapack95

make libintel64 INSTALL_DIR=~/.local/ interface=lp64 FC=gfortran

This installs LAPACK95 to ~/.local/include/ and ~/.local/lib/.

Build with Intel MKL LAPACK95 and CMake

An example CMakeLists.txt, using the FindLAPACK95.cmake under cmake/Modules of fortran-utils

cmake_minimum_required(VERSION 3.1)
project(MyProject Fortran)


find_package(LAPACK95 REQUIRED)

add_executable(myexe myprogram.f90)
target_link_libraries(myexe PRIVATE ${LAPACK95_LIBRARIES})
target_include_directories(myexe PRIVATE ${LAPACK95_INCLUDE_DIRS})


Tags: , , ,


Written by Michael Hirsch, Ph.D. //