Problem when compiling with libtorch

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Problem when compiling with libtorch

Hi Mathieu,
I'm trying to run rtabmap inside a docker container with libtorch.
Rtabmap without libtorch works well, but when I compile it with -DWITH_TORCH=ON it crashes with a segmentation fault.

I've installed libtorch 1.13.1, cuda 11.7 and cudnn The problem isn't of these libraries because I have other projects with libtorch and everything works well.
Using gdb, when running rtabmap, the error is the following

Program started...
[New Thread 0x7ffe8ffff700 (LWP 13396)]
[New Thread 0x7ffe8f7fe700 (LWP 13397)]
[New Thread 0x7ffe8effd700 (LWP 13398)]
[New Thread 0x7ffe8e7fc700 (LWP 13399)]
[New Thread 0x7ffe8dffb700 (LWP 13400)]
[New Thread 0x7ffe8d7fa700 (LWP 13401)]
[New Thread 0x7ffe8cff9700 (LWP 13402)]
[New Thread 0x7ffe6bfff700 (LWP 13403)]
[New Thread 0x7ffe6b7fe700 (LWP 13404)]
[New Thread 0x7ffe6affd700 (LWP 13405)]
[New Thread 0x7ffe6a7fc700 (LWP 13406)]
[New Thread 0x7ffe69ffb700 (LWP 13407)]
[New Thread 0x7ffe697fa700 (LWP 13408)]
[New Thread 0x7ffe68ff9700 (LWP 13409)]
[New Thread 0x7ffe4bfff700 (LWP 13410)]
[New Thread 0x7ffe4b7fe700 (LWP 13411)]
[New Thread 0x7ffe4affd700 (LWP 13412)]
[New Thread 0x7ffe4a7fc700 (LWP 13413)]
[New Thread 0x7ffe49ffb700 (LWP 13414)]
[New Thread 0x7ffe497fa700 (LWP 13415)]
[New Thread 0x7ffe48ff9700 (LWP 13416)]
[New Thread 0x7ffe2bfff700 (LWP 13417)]
[New Thread 0x7ffe2b7fe700 (LWP 13418)]
[New Thread 0x7ffe2affd700 (LWP 13419)]
[New Thread 0x7ffe2a7fc700 (LWP 13420)]
[New Thread 0x7ffe29ffb700 (LWP 13421)]
[New Thread 0x7ffe297fa700 (LWP 13422)]
[New Thread 0x7ffe28ff9700 (LWP 13423)]
[New Thread 0x7ffe0bfff700 (LWP 13424)]
[New Thread 0x7ffe0b7fe700 (LWP 13425)]
[New Thread 0x7ffe0affd700 (LWP 13426)]
[New Thread 0x7ffe0a7fc700 (LWP 13427)]
[New Thread 0x7ffe09ffb700 (LWP 13428)]
Pass 'Combine redundant instructions' is not initialized.
Verify if there is a pass dependency cycle.
Required Passes:

Thread 1 "rtabmap" received signal SIGSEGV, Segmentation fault.
0x00007fff24c09c1b in llvm::PMTopLevelManager::schedulePass(llvm::Pass*) ()
   from /usr/lib/x86_64-linux-gnu/
(gdb) bt
#0  0x00007fff24c09c1b in llvm::PMTopLevelManager::schedulePass(llvm::Pass*) ()
    at /usr/lib/x86_64-linux-gnu/
#1  0x00007fff28f36bab in  () at /usr/lib/x86_64-linux-gnu/dri/
#2  0x00007fff28f36c2f in  () at /usr/lib/x86_64-linux-gnu/dri/
#3  0x00007fff28f9495b in  () at /usr/lib/x86_64-linux-gnu/dri/
#4  0x00007fff28f88f18 in  () at /usr/lib/x86_64-linux-gnu/dri/
#5  0x00007fff28f74750 in  () at /usr/lib/x86_64-linux-gnu/dri/
#6  0x00007fff289a2f2f in  () at /usr/lib/x86_64-linux-gnu/dri/
#7  0x00007fff28b63a8e in  () at /usr/lib/x86_64-linux-gnu/dri/
#8  0x00007fff28a2e152 in  () at /usr/lib/x86_64-linux-gnu/dri/
#9  0x00007fff28a50925 in  () at /usr/lib/x86_64-linux-gnu/dri/
#10 0x00007fffefb3570a in vtkOpenGLDisplayListPainter::RenderInternal(vtkRenderer*, vtkActor*, unsigned long, bool) ()
    at /usr/lib/x86_64-linux-gnu/
#11 0x00007fffefb2f3eb in vtkOpenGLClipPlanesPainter::RenderInternal(vtkRenderer*, vtkActor*, unsigned long, bool) ()
    at /usr/lib/x86_64-linux-gnu/
#12 0x00007fffefb9a94e in vtkOpenGLScalarsToColorsPainter::RenderInternal(vtkRenderer*, vtkActor*, unsigned long, bool) () at /usr/lib/x86_64-linux-gnu/
#13 0x00007fffefbb42f9 in vtkPainterPolyDataMapper::RenderPiece(vtkRenderer*, vtkActor*) ()
    at /usr/lib/x86_64-linux-gnu/
#14 0x00007fffeee88c41 in vtkPolyDataMapper::Render(vtkRenderer*, vtkActor*) ()
    at /usr/lib/x86_64-linux-gnu/
#15 0x00007fffefb2001b in vtkOpenGLActor::Render(vtkRenderer*, vtkMapper*) ()
    at /usr/lib/x86_64-linux-gnu/
#16 0x00007ffff0d46729 in vtkLODActor::Render(vtkRenderer*, vtkMapper*) ()
    at /usr/lib/x86_64-linux-gnu/
#17 0x00007ffff0d45c0d in vtkLODActor::RenderOpaqueGeometry(vtkViewport*) ()
    at /usr/lib/x86_64-linux-gnu/
#18 0x00007fffeeea4077 in vtkRenderer::UpdateGeometry() () at /usr/lib/x86_64-linux-gnu/
#19 0x00007fffefb897fb in vtkOpenGLRenderer::DeviceRender() ()

It seems a problem of the GUI, and infact when I run rtabmap_ros with rviz the problem doesn't raise.
Do you have any idea of how to solve it?

Thanks in advance.
Reply | Threaded
Open this post in threaded view

Re: Problem when compiling with libtorch

That crash doesn't look like related to pytorch, though if it is crashing only when libtorch is linked to rtabmap, maybe libtorch is using slightly different libraries than the system's ones (maybe a different version of llvm?). Is libtorch built from source?