Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Segmentation fault: Debugging tips



  • I'm looking into a open source code set; and running into a Segmentation fault.

    Whilst I am discussing the issue here; https://github.com/OctoMap/octomap/issues/306 - perhaps I can get some general debugging suggestions from this forum.

    I am running inside a Ubuntu 18.04.4 docker container, and my host OS is Ubuntu 20.04. My GPU is a Radeon RX 570. I'm using this script to give the container GPU access - https://github.com/ros-planning/moveit/blob/master/.docker/gui-docker

    There most definitely could be things not working in my setup, the glxgears test described on http://wiki.ros.org/docker/Tutorials/Hardware Acceleration works.

    Running in gdb I get:

    (gdb) 
    (gdb) file octovis 
    Reading symbols from octovis...done.
    (gdb) run
    Starting program: /repos/octomap/bin/octovis 
    warning: Error disabling address space randomization: Operation not permitted
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    Program received signal SIGSEGV, Segmentation fault.
    0x00007f28c717c604 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
    (gdb) bt
    #0  0x00007f28c717c604 in  () at /usr/lib/x86_64-linux-gnu/libQtGui.so.4
    #1  0x00007f28cd441783 in call_init (env=0x7ffd88e7aeb8, argv=0x7ffd88e7aea8, argc=1, l=<optimized out>) at dl-init.c:72
    #2  0x00007f28cd441783 in _dl_init (main_map=0x7f28cd65a170, argc=1, argv=0x7ffd88e7aea8, env=0x7ffd88e7aeb8) at dl-init.c:119
    #3  0x00007f28cd4320ca in _dl_start_user () at /lib64/ld-linux-x86-64.so.2
    #4  0x0000000000000001 in  ()
    #5  0x00007ffd88e7c6eb in  ()
    #6  0x0000000000000000 in  ()
    

    Thanks


  • Moderators

    If you run it outside of docker, on your host system - does it crash?

    My recommendations:

    • use debug build of Qt, or supply debug symbols to GDB so it will show you more information where the crash occurs
    • compile your app in debug mode, too
    • compile with address sanitizer, it often gives better output than debugger does

    Looks like the issue happens when loading the library itself. Perhaps you have some Qt version mismatch, or build architecture differs?



  • Thanks for those pointers

    After further investigation; I realized I did indeed have qt4 & 5 dependencies installed - I thought I only had qt4.

    And; after rebuilding with only qt5 (further digging around the repo in question make me think this was viable) - it worked.

    So; not much of a learning on my part other than how to check for library dependencies

    Thanks again



  • @bgraysea said in Segmentation fault: Debugging tips:

    it worked.

    great. So if your issue is solved, then please don't forget to mark your post as solved!


Log in to reply