Failed to use libtorch components with cmake
I'm using libtorch-dev in my c++ project with cmake. All requirements are installed by apt under ubuntu 22.04 . However, it tried to find libc10.so in a wrong path.
Please reproduce as follow using docker:
- CMakeLists.txt:
cmake_minimum_
find_package(Torch REQUIRED)
- dockerfile:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y g++ libtorch-dev cmake
COPY . .
RUN cmake .
- run `docker build .`
The error message goes as follows:
-- Caffe2: Protobuf version 3.12.4
CMake Error at sr/lib/
The imported target "c10" references the file
"/
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/
but not all the files it references.
Call Stack (most recent call first):
sr/lib/
sr/lib/
CMakeLists.txt:2 (find_package)
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Ubuntu pytorch Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Chun Cai for more information if necessary.