When building a static libpytorch on macos, cmake configuration for find_package
reports the following warning:
[cmake] CMake Warning at libtorch_from_source/pytorch-build/TorchConfig.cmake:22 (message):
[cmake] static library eigen_blas_LIBRARY-NOTFOUND not found.
[cmake] Call Stack (most recent call first):
[cmake] libtorch_from_source/pytorch-build/TorchConfig.cmake:113 (append_torchlib_if_found)
[cmake] src/CMakeLists.txt:4 (find_package)
And the build later fails with link errors that look related to the missing library.
I build libpytorch with the following command (from the source directory):
mkdir pytorch-build && cd pytorch-build && cmake -DBUILD_SHARED_LIBS=OFF -DUSE_CUDA=OFF -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DPYTHON_EXECUTABLE:PATH=`which python3` -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-build ../pytorch && cmake --build . --target install
And this is the CMakeLists.txt that contains the find_package
:
set(Torch_DIR ${CMAKE_SOURCE_DIR}/libtorch_from_source/pytorch-build)
set(ENV{TORCH_INSTALL_PREFIX} ${CMAKE_SOURCE_DIR}/libtorch_from_source/pytorch-build)
find_package(Torch 1.8.0 EXACT REQUIRED)
add_executable(myexec main.cpp)
target_link_libraries(myexec PRIVATE "${TORCH_LIBRARIES}")
target_include_directories(myexec PRIVATE "${TORCH_INCLUDE_DIRS}")
question from:
https://stackoverflow.com/questions/65845704/libpytorch-macos-build-static-library-eigen-blas-library-notfound-not-found 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…