Libtorch cmake error on Centos7

(Xia Xuehai) #1

Download libtorch from official website without CUDA. Cmake version:2.8.12. Then find_package(Torch REQUIRED) and got an error:

[root@xxx build]# cmake .. -DCMAKE_PREFIX_PATH=/home/xxx/cnn/libtorch/
-- /home/xxx/cnn/libtorch
-- torch;caffe2_library;/home/for_faiss/crnn/libtorch/lib/libc10.so
-- /home/for_faiss/crnn/libtorch/include;/home/for_faiss/crnn/libtorch/include/torch/csrc/api/include
-- Configuring done
CMake Error at libtorch/share/cmake/Caffe2/public/threads.cmake:5 (add_library):
  Cannot find source file:

    INTERFACE

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx
Call Stack (most recent call first):
  libtorch/share/cmake/Caffe2/Caffe2Config.cmake:17 (include)
  libtorch/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
  CMakeLists.txt:4 (find_package)


CMake Error in CMakeLists.txt:
  Cannot find source file:

    IMPORTED

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx


-- Build files have been written to: /home/for_faiss/crnn/build

(Xia Xuehai) #2

Solved. Cmake 3.10 is fine.