Open averatio opened 1 year ago
This is an MKL linking issue
Did you manage to resolve this? I have a similar linking problem.
(What is MKL?)
@averatio @mdouze @arjenpdevries I spent some time finding a solution to this problem. After building cmake 3.26
from source, and then reading the source for cmake
, I found an obscure reference to the need to use a specific environment setup script in /opt/intel
.
The full build process (minus cmake
) is here:
https://github.com/artificialwisdomai/origin/wiki/Build-from-source
Thank you -steve
This seems to be an issue that occurs when DBUILD_TESTING=ON, and it's a problem with a missing link to liblapack. If you set DBUILD_TESTING to OFF, libfaiss_avx2.so will be generated successfully, but it reports this error when it is used. This problem occurs because in faiss/faiss/CMakeLists.txt, it checks if MKL is found, and if it is found, it doesn't link LAPACK, but when compiling the test, it need this. My solution is to make it link LAPACK under the condition that MKL_FOUND=True in this CMakeLists.txt: ''' if(MKL_FOUND) target_link_libraries(faiss PRIVATE ${MKL_LIBRARIES}) target_link_libraries(faiss_avx2 PRIVATE ${MKL_LIBRARIES}) target_link_libraries(faiss_avx512 PRIVATE ${MKL_LIBRARIES}) find_package(LAPACK REQUIRED) target_link_libraries(faiss PRIVATE ${LAPACK_LIBRARIES}) target_link_libraries(faiss_avx2 PRIVATE ${LAPACK_LIBRARIES}) target_link_libraries(faiss_avx512 PRIVATE ${LAPACK_LIBRARIES}) else() ... ''' I tried many other attempts to solve this issue, but this is what I think is the most crucial.
Summary
Platform
OS:[ ] Linux Debian Python 3.10
Faiss version: 1.7.3
Installed from: source code
Faiss compilation options: cmake -B build . -DFAISS_ENABLE_GPU=OFF -DBLA_VENDOR=Intel10_64_dyn -DFAISS_OPT_LEVEL=avx2 -DBUILD_SHARED_LIBS=ON -DFAISS_ENABLE_C_API=ON -DMKL_LIBRARIES=$MKL_HOME
Running on:
Interface:
Reproduction instructions
Hi All All this works:
Python faiss lib works, however,
fails with link error:
I looked at various mailing lists and found some guidance but no advice worked yet. Any clue or advice will be greatly appreciated.
regards