Compiling UMFPACK with Microsoft Visual C


UMFPACK is Unsymmetric MultiFrontal direct solver for sparse matrices developed by Prof Timothy A. Davis:

In this document I will explain how to modify configurations files in the UMFPACK distribution in order to compile it directly with Microsoft Visual C by using GNU Make under Cygwin. For simplicity I have limited myself to the case without BLAS (UMFPACK_CONFIG = -DNBLAS) but when you understand what I have done it should be easy to change it.

It is assumed that you have already seen the following information

Compiling UMFPACK
Using Microsoft Visual C under Gygwin
Compiling and Linking: Simple Example with Visual C++

The idea is that Visual C can be used from the command line (cl) and by editing makefiles it is just necessary to modify some lines that will take make how to call cl correctly.

It is necessary to modify four files


and below I have documented the changes that I have done in the case of UMFPACK 5.2.0. In previous versions GNUmakefile could reside in another directory.

All makefiles in the UMFPACK distribution includes and for Unix compilers it is enough to modify this file only. Unfortunately it is not the case with Visual C, as it uses some options that are completely different from what one can find on Unix.


First let us instruct make to use cl as a C compiler with appropriate flags

CC = cl
CFLAGS = -O2 -MD -nologo

Please modify compiler options according to your needs. Note that CFLAGS are defined in the original file twice and it is necessary to comment the second definition out. Then a librarian in Visual C is lib and one does not need ranlib.

RANLIB = echo
AR = lib

As I have mentioned above I will not use BLAS


Just enter here the optimized BLAS library if you need it and remove -DNBLAS. Note that UMFPACK calls Fortran BLAS and the names of subroutines are defined in cholmod_blas.h. If for some reason they are defined differently in your optimized BLAS, just edit this file.


When there is GNUmakefile and Makefile in the same directory, GNU Make uses GNUmakefile, so we have to edit it (not Makefile). If you use another make, you can edit Makefile on the similar way.

It is necessary to change “-o ” to “-Fo” in three lines such as

$(C) -c $< -o $@

as -Fofilename without space is the flag for cl to specify the output name of the object file.

Then it is necessary to replace through the whole file libamd.a to libamd.lib and change the line with the command for the librarian (output flag -out:filename)

$(AR) -out:../Lib/libamd.lib $^


Changes here are analogous to those for AMD/Lib/GNUmakefile, that is, the output flag for object files, the name of the library (libumfpack.a to libumfpack.lib) and the output flag for the librarian.

As there are more lines to call C compiler, it is possible to do changes for the output compiler flag at once with something like

$ sed "s/-o /-Fo/" GNUmakefile


Here it is necessary to change the names of the libraries from *.a to *.lib and to add -b to diff. The latter tells diff to ignore the differences in end-of-line. It is possible to leave -o flag without changes here, as cl correctly passes it to the linker, even though it complains that this is not the right way to do it.


With the changes above the command make in the directory UMFPACK builds two libraries and executables in Demo. cl makes warning for some C files about not recognized pragmas (it does not understand #pragma ivdep) but it seems that this can be ignored.


How to create MS VC++ project for UMFPACK

Comments are closed.