HermesInstall

From Intelligent Materials and Systems Lab

Here are described some problems/solutions that came up while I was trying to compile Hermes3D software with GNU compiler in 64bit Debian Linux. The installation was performed under user privileges, so all needed packages were installed under user home directory. One problem is cmake and the fact that sometimes it could not find required packages properly.

Problem 1 - BLAS NOT FOUND

I had successfully installed Atlas BLAS and the script <CMAKE INSTALLATION DIR>/Modules/FindBLAS.cmake couldn't find it. Solution is based on this helpful post. Find the following section in FindBlas.cmake:

# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
 check_fortran_libraries(
 BLAS_LIBRARIES
 BLAS
 cblas_dgemm
 ""
 "cblas;f77blas;atlas"
 ""
 )

and change "cblas_dgemm" to "dgemm". Worked for me.

Problem 2 - Flag -fPIC

Hermes builds shared libraries and all libraries that are linked must be compiled with -fPIC flag. Otherwise compiler outputs something like this:

relocation R_X86_64_32 against `a local symbol' can not be used
when making a shared object; recompile with -fPIC .libs/assert.o: could not
read symbols: Bad value

So I recompiled with -fPIC and got rid of this problem. Read more from this page.

Problem 3 - SuiteSparse libraries were not linked

So I tried to link them "manually".

Instead of running 'cmake' directly from command line i created simple script file: cmake \ -DSUITESPARSE_INCLUDE_DIR=/home/user/include \ -DCHOLMOD_LIBRARY=/home/user/lib/libcholmod.a \ -DCAMD_LIBRARY=/home/user/lib/libcamd.a \ -DCCOLAMD_LIBRARY=/home/user/lib/libccolamd.a \ -DCOLAMD_LIBRARY=/home/user/lib/libcolamd.a \ -DMETIS_LIBRARY=/home/user/lib/libmetis.a \

Also I replaced the WITH_UMFPACK section in src/CMakeLists.txt and added SuiteSparse libraries:

       if(WITH_UMFPACK)
               include_directories(${UMFPACK_INCLUDE_DIR} ${AMD_INCLUDE_DIR})
               include_directories($SUITESPARSE_INCLUDE_DIR)
               target_link_libraries(${BIN} ${UMFPACK_LIBRARY})
               target_link_libraries(${BIN} ${LAPACK_LIBRARIES})
               target_link_libraries(${BIN} ${CHOLMOD_LIBRARY})
               target_link_libraries(${BIN} ${CCOLAMD_LIBRARY})
               target_link_libraries(${BIN} ${CAMD_LIBRARY})
               target_link_libraries(${BIN} ${COLAMD_LIBRARY})
               target_link_libraries(${BIN} ${AMD_LIBRARY})
               target_link_libraries(${BIN} ${METIS_LIBRARY})
       endif(WITH_UMFPACK)


And it linked...