flashlight: MKL library not found
Question
Cmake is not able to find MKL while installing flashlight(building other dependencies using vcpkg and building ArrayFire from the source). Using Macbook Air (M1 chip).
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DFL_BACKEND=CPU \
-DCMAKE_TOOLCHAIN_FILE=/Users/sahilgoyal/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DArrayFire_DIR=/Users/sahilgoyal/arrayfire/build/cmake/install/ArrayFireConfig.cmake \
-DFL_BUILD_DISTRIBUTED=OFF
make -j2
make install -j2
Attaching output
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test COMPILER_SUPPORTS_RDYNAMIC
-- Performing Test COMPILER_SUPPORTS_RDYNAMIC - Success
-- -rdynamic supported.
-- Found GTest: /Users/sahilgoyal/vcpkg/installed/arm64-osx/share/GTest/GTestConfig.cmake (found suitable version "1.10.0", minimum required is "1.10.0")
-- gtest found: (include: , lib: GTest::gtest;GTest::gtest_main
-- Found gtest and gmock on system.
-- Will build flashlight libraries.
-- MKL_THREADING = OMP
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - iomp5 - pthread - m]
-- Library mkl_intel_lp64: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_lp64.dylib
-- Library mkl_intel_thread: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_thread.dylib
-- Library mkl_core: /opt/intel/oneapi/mkl/latest/lib/libmkl_core.dylib
-- Library iomp5: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - iomp5 - pthread - m]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - guide - pthread - m]
-- Library mkl_intel_lp64: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_lp64.dylib
-- Library mkl_intel_thread: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_thread.dylib
-- Library mkl_core: /opt/intel/oneapi/mkl/latest/lib/libmkl_core.dylib
-- Library guide: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - guide - pthread - m]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - pthread - m]
-- Library mkl_intel_lp64: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_lp64.dylib
-- Library mkl_intel_thread: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_thread.dylib
-- Library mkl_core: /opt/intel/oneapi/mkl/latest/lib/libmkl_core.dylib
-- Library pthread: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libpthread.tbd
-- Library m: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libm.tbd
-- Looking for cblas_sgemm
-- Looking for cblas_sgemm - not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - pthread - m]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_sequential - mkl_core - m]
-- Library mkl_intel_lp64: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_lp64.dylib
-- Library mkl_sequential: /opt/intel/oneapi/mkl/latest/lib/libmkl_sequential.dylib
-- Library mkl_core: /opt/intel/oneapi/mkl/latest/lib/libmkl_core.dylib
-- Library m: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libm.tbd
-- Looking for cblas_sgemm
-- Looking for cblas_sgemm - not found
-- Checking for [mkl_intel - mkl_sequential - mkl_core - m]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_core - iomp5 - pthread - m]
-- Library mkl_intel_lp64: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_lp64.dylib
-- Library mkl_core: /opt/intel/oneapi/mkl/latest/lib/libmkl_core.dylib
-- Library iomp5: not found
-- Checking for [mkl_intel - mkl_core - iomp5 - pthread - m]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_core - guide - pthread - m]
-- Library mkl_intel_lp64: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_lp64.dylib
-- Library mkl_core: /opt/intel/oneapi/mkl/latest/lib/libmkl_core.dylib
-- Library guide: not found
-- Checking for [mkl_intel - mkl_core - guide - pthread - m]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_core - pthread - m]
-- Library mkl_intel_lp64: /opt/intel/oneapi/mkl/latest/lib/libmkl_intel_lp64.dylib
-- Library mkl_core: /opt/intel/oneapi/mkl/latest/lib/libmkl_core.dylib
-- Library pthread: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libpthread.tbd
-- Library m: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libm.tbd
-- Looking for cblas_sgemm
-- Looking for cblas_sgemm - not found
-- Checking for [mkl_intel - mkl_core - pthread - m]
-- Library mkl_intel: not found
-- Checking for [mkl - guide - pthread - m]
-- Library mkl: not found
CMake Error at cmake/FindMKL.cmake:400 (MESSAGE):
MKL library not found. Please specify library location by appending the
root directory of the MKL installation to the environment variable
CMAKE_PREFIX_PATH.
Call Stack (most recent call first):
/Users/sahilgoyal/vcpkg/scripts/buildsystems/vcpkg.cmake:764 (_find_package)
flashlight/lib/audio/feature/CMakeLists.txt:6 (find_package)
flashlight/lib/audio/CMakeLists.txt:6 (include)
flashlight/lib/CMakeLists.txt:31 (include)
CMakeLists.txt:133 (include)
-- Configuring incomplete, errors occurred!
See also "/Users/sahilgoyal/flashlight/build/CMakeFiles/CMakeOutput.log".
See also "/Users/sahilgoyal/flashlight/build/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
Error-log file(Here it seems a Mac related issue) CMakeError.log
Additional Context
Tried following
export CMAKE_PREFIX_PATH="/opt/intel/oneapi/mkl/latest:$PATH"
export MKLROOT=/opt/intel/oneapi/mkl/latest
export CMAKE_LIBRARY_PATH='/opt/intel/oneapi/mkl/latest/lib'
Followed this to install intel-mkl https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html?operatingsystem=mac&distributions=webdownload&options=online
Please Help!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (4 by maintainers)
If anyone is still facing the same issue…
I solved this MKL library not found issue. For some reason Flashlight doesn’t recognize MKL library installed via intel’s official website (which installs one-api). I solved it by installing MKL library via a specific apt package. I’ll share my solution below.
This installs MKL library under
/opt/intel/mkl
. (Note that if you install MKL library following the official instructions it’s installed under/opt/intel/oneapi/mkl
) With this installation, Flashlight successfully finds the MKL library. You don’t even need to specify MKLROOT environment variable. (Of course you can doexport MKLROOT="/opt/intel/mkl"
if you want to.)I adopted this solution from the official dockerfile.
I don’t know why it involves too much headache to build the flashlight library. I tried various methods (such as building with vcpkg which gave me some ArrayFire error (mkl-threading library missing), then I tried building ArrayFire from source and all other dependencies via vcpkg then this error appeared) but was successful only via docker(CPU) which is too slow to use. I also tried to use docker(CUDA) but
nvidia-smi
was not working there, means CUDA is not installed in docker itself.I’ve been trying for 3 days now to install it and keep going in circles with dependency issues. Worst installation I’ve ever dealt with T_T
@sahilg06 I did not have to link it to vcpkg to compile, I just used
. /opt/intel/oneapi/setvars.sh
to set environment variables and it worked (I did have to fix/vcpkg/ports/flashlight-cuda/portfile.cmake
tho)