jia-kai / SANM

A symbolic asymptotic numerical solver
MIT License
30 stars 2 forks source link

Build errors: Undefined reference to `pardiso' etc. #1

Closed joy-xiaojizhang closed 3 years ago

joy-xiaojizhang commented 3 years ago

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 .

jia-kai commented 3 years ago

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.
jia-kai commented 3 years ago

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 https://github.com/jia-kai/SANM/commit/2673ac476b3d2978a52bf47bc12d3402ea20f211