Libtorch with ROS

I am having a hard time running pytorch model with ROS in C++. The torchlib breaks the ROS when I try to include it in my package cmakelist. I included the moden ABI by “add_compile_options(-std=c++11 -D_GLIBCXX_USE_CXX11_ABI=1)” but it didn’t help too.

After many tries I decided to built pytorch but then I got a new error for c10, the error log can be found here I tried changes in the previous similar post but nothing is helping. The TORCH_CXX_FLAGS D_GLIBCXX_USE_CXX11_ABI=1 flag is already 1 for me as default in the TorchConfig.cmake.

I am using ROS Kinetic and my gcc version is 5.4

I think there are a few things we need to check:

  1. Is libtorch built with _GLIBCXX_USE_CXX11_ABI=1? (i.e. did you see -- Determined _GLIBCXX_USE_CXX11_ABI=1 in the libtorch build log?)

  2. Are you building vehicle_detection with the same compiler and with _GLIBCXX_USE_CXX11_ABI=1?

Hi Will,

Yes I made sure both are using the same ABI. I am using
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1) for ROS package cmake files and changed the TorchConfig.cmake for the pytorch one.


Its been 9 days and I am still stuck, would someone please help me out

We now have new ABI binaries for libtorch. They can be found on, or at Can you try and see if it solves the problem?