Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
516 views
in Technique[技术] by (71.8m points)

c++ - libpytorch macos build: static library eigen_blas_LIBRARY-NOTFOUND not found

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...