introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.83k stars 787 forks source link

can not find libtorch #531

Open zengqiang365 opened 4 years ago

zengqiang365 commented 4 years ago

Do we need to add FindTorch.cmake? whick version do we need? thanks

matlabbe commented 4 years ago

No need to add FindTorch.cmake, we use directly the TorchConfig.cmake contained in the installed binaries of libtorch (TorchConfig.cmake should also exists if you built libtorch from source).

For example, if you downloaded libtorch-cxx11-abi-shared-with-deps-1.4.0.zip, to build with it do:

$ cd rtabmap/build
$ cmake -DTorch_DIR=~/libtorch-cxx11-abi-shared-with-deps-1.4.0/libtorch/share/cmake/Torch ..

Note that I just committed a small fix to make it build with latest 1.4.0.

The superpoint.pt weights file can be downloaded on https://github.com/KinglittleQ/SuperPoint_SLAM

EDIT If rtabmap_ros is also built, append to LD_LIBRARY_PATH the path containing torch libraries to avoid libtorch.so not found error by the linker:

export LD_LIBRARY_PATH=LD_LIBRARY_PATH:~/libtorch-cxx11-abi-shared-with-deps-1.4.0/libtorch/lib

cheers, Mathieu