Many open source math libraries will depend on a BLAS / LAPACK provider being available on your system. While for Linux it’s just a matter of installing one of the providers maintained by your distribution, for Windows users this had been a hassle for a long time. In recent years it has become a lot easier with three major providers offering both binary redistributables and dev packages. This post describes where to obtain the relevant packages for Windows. You might also want to read about how to manage C/C++ library dependencies on Windows.
OpenBLAS
OpenBLAS is an open source library distributed under 3-clause BSD license. You can obtain precompiled versions from github.com/OpenMathLib/OpenBLAS/releases. The latest version (as of July 2025) is 0.3.30.
The shared link library libopenblas.lib
might not work for Visual Studio users, so you will have to create a new import library:
- Open Visual Studio
x64 Native Tools Command Prompt
- cd to the directory that contains
libopenblas.def
, - Delete existing
libopenblas.lib
(you can actually delete all files exceptlibopenblas.def
) - Run
lib /def:libopenblas.def /machine:x64 /out:libopenblas.lib
Optionally, you can extract the exported symbols with dumpbin /EXPORTS libopenblas.dll > libopenblas.exp
and then copy the symbol names to libopenblas.def
.
You can use OpenBLAS with CMake by setting the BLA_VENDOR option to OpenBLAS
. If the libraries cannot be found automatically, specify them explicitly using
cmake -DBLA_VENDOR=OpenBLAS
-DBLAS_LIBRARIES=C:/usr/lib/libopenblas.lib
-DLAPACK_LIBRARIES=C:/usr/lib/libopenblas.lib
[... other options]
Adjust the paths as needed.
Intel MKL
Intel’s oneAPI Math Kernel Library is distributed under the Intel Simplified Software License, also see license FAQ. To get started, use the following Nuget packages:
- intelmkl.devel.win-x64 contains headers and dynamic link libraries
- intelmkl.static.win-x64 contains headers and static link libraries
- intelmkl.redist.win-x64 contains the runtime libraries
You can use those packages with CMake by specifying the BLA_VENDOR option, for example Intel10_64_dyn
to link against the single, dynamic mkl_rt
DLL. In case you are not using CMake, add the dependencies manually to your Visual Studio project. Always link mkl_core.lib
. For 32-bit integer type add mkl_intel_lp64.lib
, for 64-bit integers mkl_intel_ilp64.lib
. Then add one of the following libraries:
mkl_sequential.lib
for the sequential versionmkl_intel_thread.lib
for the OpenMP versionmkl_tbb_thread.lib
for the TBB version
The last two options will result in additional dependencies on Intel OpenMP or Intel TBB. You can also download a stand-alone installer, which might help integrating MKL into Visual Studio.
AMD Optimizing CPU Libraries
The AMD Optimizing CPU Libraries (AOCL) are a set of (mostly) open source libraries compiled for AMD processors. The BLAS/LAPACK libraries are based on BLIS and libflame, both distributed under 3-clause BSD license.
You can use those packages with CMake by specifying the BLA_VENDOR option AOCL
or AOCL_mt
.
Building BLAS and LAPACK
Another option is to compile the libraries by yourself.
CLAPACK for Windows
A non-optimized version of BLAS and LAPACK is available at https://icl.cs.utk.edu/lapack-for-windows/clapack/index.html. This LAPACK version (3.2.1) was released in 2009, so it’s rather outdated and I recommend using one of the providers presented above. But it still might be useful to get started quickly without depending on foreign DLLs.
The FORTRAN code is already translated to C, so we can use Visual Studio to compile the sources. Download the source code archive (direct link) and extract it to a folder of your choice. We will use CMake, so if you don’t have it installed already, go to https://cmake.org/download/ and download the latest version. Make sure that cmake
is in your PATH
, open a terminal in the CLAPACK root folder and run the following build commands (adjust the install prefix):
cmake -B build -DBUILD_TESTING=OFF
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX="path/to/install"
cmake --build build
cmake --install build
This will build static libraries libf2c.lib
, blas.lib
and lapack.lib
. f2c is the Fortran-to-C compiler that was used to translate the code. All three libraries have to be linked.
You can use those libraries with CMake by setting the following options:
cmake -DBLA_VENDOR=Generic
-DBLA_STATIC=ON
-DBLAS_LIBRARIES=C:/usr/lib/libf2c.lib;C:/usr/lib/blas.lib
-DLAPACK_LIBRARIES=C:/usr/lib/libf2c.lib;C:/usr/lib/lapack.lib
[... other options]
Adjust the paths as needed.
Please use the contact form for comments.