mfem / mfem

Lightweight, general, scalable C++ library for finite element methods
http://mfem.org
BSD 3-Clause "New" or "Revised" License
1.67k stars 487 forks source link

Compilation with SuiteSparse on Mac OSX #909

Closed e-aranda closed 5 years ago

e-aranda commented 5 years ago

I am trying to compile MFEM (downloaded from Github) with SuiteSparse on a Mac OSX. Compilation process is ok, but when I try make check, then a linker error is found: the umfpack and klu libraries are not found. As make check essentially run

g++  -O3 -std=c++11 -I..  ex1.cpp -o ex1 -L.. -lmfem -lrt

if I add '-lumfpack -lklu' to that line then compilation of example is ok. I don't understand what is happening because make check in linux gives no errors.

Any hints? Thanks, Ernesto

tzanio commented 5 years ago

Just to double check -- you configured with MFEM_USE_SUITESPARSE and if necessary adjusted the SUITESPARSE_DIR in config/default.mk?

e-aranda commented 5 years ago

Ok, I was using compilation options

MFEM_USE_SUITESPARSE=YES SUITESPARSE_LIB=-L/path/to/SuiteSparse/lib 
SUITESPARSE_OPT=-I/path/to/SuiteSparse/opt 

and compilation is ok, but make check gives the mentioned error.

Now, with

MFEM_USE_SUITESPARSE=YES SUITESPARSE_DIR=/path/to/SuiteSparse

it works well. I am a little confuse because in linux, the first option works.

tzanio commented 5 years ago

SUITESPARSE_LIB should include -lumfpack -lklu, not just -L ..., see https://github.com/mfem/mfem/blob/master/config/defaults.mk#L197-L199.

e-aranda commented 5 years ago

Ok, that was my mistake. If I use SUITESPARSE_LIB, then the variable in default.mk is overwritten. Thanks, Ernesto