jia-kai/SANM

Build errors: Undefined reference to `pardiso' etc.

Closed this issue · 2 comments

I have followed the build commands in the README, and run into several make errors regarding MKL functions including Pardiso, LAPACK, and sparse solves. I am using the latest version of OneAPI, and can confirm that its CMake path is correct, since all the relevant headers can be found during compilation.

build_error.txt

The headers and libraries can be found under the correct paths. E.g. :
~/cloth/SANM/build$ grep -R 'pardiso' Binary file libsanm/CMakeFiles/sanm_lib.dir/sparse_solver.cpp.o matches Binary file libsanm/libsanm_lib.a matches fea/CMakeFiles/fea.dir/depend.make:fea/CMakeFiles/fea.dir/main.cpp.o: /mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/depend.make:fea/CMakeFiles/fea.dir/material.cpp.o: /mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/depend.make:fea/CMakeFiles/fea.dir/mesh.cpp.o: /mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/depend.make:fea/CMakeFiles/fea.dir/tetrahedral_mesh.cpp.o: /mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/CXX.includecache:mkl_pardiso.h fea/CMakeFiles/fea.dir/CXX.includecache:/mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/CXX.includecache:/mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/depend.internal: /mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/depend.internal: /mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/depend.internal: /mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h fea/CMakeFiles/fea.dir/depend.internal: /mnt/bigdisk/joy/intel/oneapi/mkl/latest/include/mkl_pardiso.h

This happens at the make step [ 68%] Linking CXX executable sanm_tests .

The problem is that the MKL library has not been found. The grep command only confirms that the header files exist but says nothing about the library files.

I'd suggest checking two things:

  1. Is everything 64-bit? (Including CPU, OS, compiler, and OneAPI libraries)
  2. Check if the OneAPI libraries are good: nm -D /mnt/bigdisk/joy/intel/oneapi/mkl/latest/lib/intel64/libmkl_intel_ilp64.so | grep -w pardiso should print a line with the T symbol type.

It turns out that we should use target_link_libraries instead of target_link_options (the former produces wrong linker argument order on an older cmake)

See 2673ac4