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


15 responses to “Compiling UMFPACK with Microsoft Visual C”

Comments are now closed
  1. Baydoun says:

    I have used your procedure to compile umfpack using Visual Studio. It works well for sparse matrices of 13×13 and less.
    if the size is larger, the .exe stops working and I get an error message from cmd telling that a problem caused the program to stop working correctly. windows will close the program and notify you if a solution is available. MAybe you could help me if a parameter has to be changed or something??

  2. Such a response usually means that you go over the border of some array. Say, you first define

    double a[13];

    and then use

    a[13] = 10;

    Something like this. Please just check your code that calls UMFPACK.

  3. Baydoun says:

    Well, After checking all the matrices and status reports.
    I was able to narrow the problem to umfpack_di_numeric.
    The crash is simply inexplicable.
    The exact same function works very well under linux.

  4. I have a driver to run UMFPACK

    If you upload your matrix to somewhere, I could try it with my code. I do not remember problems to run UMFPACK on Windows.

  5. Baydoun says:

    Thanks alot for your fast reply.
    I solved the problem! apparently there was a problem with libumfpack.lib. I have exported a new library for umfpack and now it works. could you tell me the final size of your libumpack.lib?

  6. My umfpack.lib is 852 Kb but it is already pretty old.

  7. Ashish says:


    I could make libamd.lib but make fails while building UMFPACK. Here is an error

    make[1]: *** No rule to make target `umf_i_analyze.o’, needed by `../Lib/libumfpack.lib’. Stop.


  8. Please check that you have copied the makefile correctly. What make do you use?

  9. Baydoun says:

    My umfpack library is 1.47 MB :S
    @Ashish, I had the same problem but I was able to solve it. It can depend on different factors.
    It was really frustrating, if you need help leave here your private email, I can send you my library.

  10. Ashish says:

    Thanks for quick reply guys.

    I had copied GNUMakefile from above links. After comparing this with original unix GNUMakefile I found one extra file in UMFCH variable. It is umf_2by2. I could not find this file in source, so removed it and could compile UMFPACK. I also added umf_cholmod in UMFINT

  11. I cannot exclude that my modifed makefiles are for the older version of UMFPACK.

  12. MS says:

    Pity it doesn’t work, and the tutorial is very chaotic and undetailed. :(
    Description is very general, as there are many makefiles and it is not mentioned which to modify.

  13. You are welcome to write a better text.

  14. Chen Li says:

    Hi, thanks very much for this introduction!
    I have a problem when compiler UMFPACK with BLAS using cl.
    It seems correct to generate the libumfpack.lib.
    The error is about linking:
    libumfpack.lib(umf_di_blas3_update.o) : error LNK2019: unresolved external symbo
    l _dgemm referenced in function _umfdi_blas3_update
    libumfpack.lib(umf_di_blas3_update.o) : error LNK2019: unresolved external symbo
    l _dtrsm referenced in function _umfdi_blas3_update
    libumfpack.lib(umf_di_blas3_update.o) : error LNK2019: unresolved external symbo
    l _dger referenced in function _umfdi_blas3_update
    libumfpack.lib(umf_di_local_search.o) : error LNK2019: unresolved external symbo
    l _dgemv referenced in function _umfdi_local_search
    libumfpack.lib(umf_di_local_search.o) : error LNK2019: unresolved external symbo
    l _dtrsv referenced in function _umfdi_local_search
    umfpack_simple.exe : fatal error LNK1120: 5 unresolved externals

    my compiler command is:
    $ cl -MD -I../UMFPACK/Include -I../AMD/Include -I../UFconfig umfpack_simple.c libumfpack.lib libamd.lib libf77blas.lib libatlas.lib libg2c.lib libgcc.lib

  15. These are BLAS functions. They should be in libf77blas.lib. Please check with nm, whether they there or not.