Issue with QVTKWidget in QT Ros workspace



  • I am new to QT and ROS. I am working on QT Creator 4.8.0. I have created a catkin workspace in QT and a mainwindow was created. And I am trying to add QVTKWidget to the mainwindow. It was successfully built but when it is run, an error message is displayed.

    Code: mainwindow.cpp

    vtkWidget = new QVTKWidget; // When this line of code is executed, runtime error occurs.
    ui.verticalLayout->addWidget(vtkWidget);
    ui.verticalLayout->update();
    ren = vtkRenderer::New();
    vtkWidget->GetRenderWindow()->AddRenderer(ren);
    ren->SetBackground(1.0,0,0);
    ren->Render();

    Error:realloc(): invalid pointer: 0x00007facb5723820 ***
    ======= Backtrace: =========
    /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7facb37d77e5]
    /lib/x86_64-linux-gnu/libc.so.6(+0x85d80)[0x7facb37e5d80]
    /lib/x86_64-linux-gnu/libc.so.6(realloc+0x22f)[0x7facb37e48ef]
    /usr/lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN9QListData7reallocEi+0x1f)[0x7facada009cf]
    /usr/lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN9QListData6appendEi+0x81)[0x7facada00aa1]
    /usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x1d6d78)[0x7facadaccd78]
    /usr/lib/x86_64-linux-gnu/libQt5Core.so.5(Z21qRegisterResourceDataiPKhS0_S0+0x2e6)[0x7facadac8b16]
    /usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x7bcc3)[0x7facad971cc3]
    /lib64/ld-linux-x86-64.so.2(+0x106ba)[0x7facb6c5a6ba]
    /lib64/ld-linux-x86-64.so.2(+0x107cb)[0x7facb6c5a7cb]
    /lib64/ld-linux-x86-64.so.2(+0xc6a)[0x7facb6c4ac6a]



  • Did you build VTK as shared libraries? Did you add the location of the VTK shared libs to the library search path? What does ldd applicationName show for the VTK libraries (replace 'applicationName' with your executable)?



  • Actually I didn't build VTK. It was already there. So I assume it came with the QT installed.
    As you have suggested , by running the command ldd applicationName I got the following libraries:
    linux-vdso.so.1 => (0x00007ffc42bd3000)
    libvtkRenderingFreeTypeOpenGL-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkRenderingFreeTypeOpenGL-6.2.so.6.2 (0x00007f00fc49f000)
    libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007f00fb7ab000)
    libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007f00fb2b7000)
    libvtkRenderingFreeType-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkRenderingFreeType-6.2.so.6.2 (0x00007f00faff4000)
    libvtkGUISupportQt-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkGUISupportQt-6.2.so.6.2 (0x00007f00fada9000)
    libvtkInteractionStyle-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkInteractionStyle-6.2.so.6.2 (0x00007f00fab1c000)
    libvtkRenderingOpenGL-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkRenderingOpenGL-6.2.so.6.2 (0x00007f00fa674000)
    libvtkCommonCore-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonCore-6.2.so.6.2 (0x00007f00fa146000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f00f9dc3000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f00f9bad000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f00f97e3000)
    libvtkftgl-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkftgl-6.2.so.6.2 (0x00007f00f95d7000)
    libvtkRenderingCore-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkRenderingCore-6.2.so.6.2 (0x00007f00f9143000)
    libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f00f8ecf000)
    libvtkCommonExecutionModel-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.2.so.6.2 (0x00007f00f8c20000)
    libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f00f89dd000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f00f87c0000)
    libaudio.so.2 => /usr/lib/x86_64-linux-gnu/libaudio.so.2 (0x00007f00f85a6000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f00f8295000)
    libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f00f8070000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f00f7e55000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f00f7bab000)
    libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f00f7958000)
    libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f00f774f000)
    libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f00f7535000)
    libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f00f7325000)
    libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f00f711a000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f00f6f08000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f00f6bce000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f00f68c4000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f00f66c0000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f00f64b8000)
    /lib64/ld-linux-x86-64.so.2 (0x000055c376c37000)
    libvtkCommonDataModel-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonDataModel-6.2.so.6.2 (0x00007f00f5f48000)
    libQt5Widgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007f00f58bb000)
    libvtkFiltersExtraction-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkFiltersExtraction-6.2.so.6.2 (0x00007f00f55a5000)
    libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007f00f505d000)
    libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f00f4b87000)
    libvtkFiltersSources-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkFiltersSources-6.2.so.6.2 (0x00007f00f48c0000)
    libvtkCommonTransforms-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonTransforms-6.2.so.6.2 (0x00007f00f4691000)
    libvtkCommonMath-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonMath-6.2.so.6.2 (0x00007f00f446f000)
    libvtkImagingHybrid-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkImagingHybrid-6.2.so.6.2 (0x00007f00f4204000)
    libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007f00f3f9b000)
    libvtkIOImage-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2 (0x00007f00f3c33000)
    libvtkCommonSystem-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonSystem-6.2.so.6.2 (0x00007f00f3a1f000)
    libvtksys-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtksys-6.2.so.6.2 (0x00007f00f37da000)
    libvtkCommonColor-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonColor-6.2.so.6.2 (0x00007f00f35bd000)
    libvtkFiltersGeometry-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkFiltersGeometry-6.2.so.6.2 (0x00007f00f332e000)
    libvtkFiltersGeneral-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkFiltersGeneral-6.2.so.6.2 (0x00007f00f2e03000)
    libvtkCommonComputationalGeometry-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonComputationalGeometry-6.2.so.6.2 (0x00007f00f2bc4000)
    libvtkFiltersCore-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkFiltersCore-6.2.so.6.2 (0x00007f00f2606000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f00f23dc000)
    libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f00f21d9000)
    libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f00f1fd6000)
    libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f00f1dce000)
    libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f00f1bcb000)
    libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f00f199a000)
    libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f00f1796000)
    libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f00f1590000)
    libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f00f138e000)
    libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f00f1174000)
    libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f00f0f6f000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f00f0d4d000)
    libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f00f0b46000)
    libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f00f0934000)
    libvtkCommonMisc-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonMisc-6.2.so.6.2 (0x00007f00f071d000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f00f0519000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f00f02a8000)
    libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f00f00a0000)
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f00efe9b000)
    libvtkFiltersStatistics-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkFiltersStatistics-6.2.so.6.2 (0x00007f00efc0e000)
    libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f00ef9b0000)
    libicui18n.so.55 => /usr/lib/x86_64-linux-gnu/libicui18n.so.55 (0x00007f00ef54d000)
    libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007f00ef1b9000)
    libpcre16.so.3 => /usr/lib/x86_64-linux-gnu/libpcre16.so.3 (0x00007f00eef53000)
    libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f00eecf9000)
    libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f00eea84000)
    libvtkmetaio-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkmetaio-6.2.so.6.2 (0x00007f00ee7ee000)
    libvtkDICOMParser-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkDICOMParser-6.2.so.6.2 (0x00007f00ee5d6000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f00ee3cf000)
    libvtkImagingFourier-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkImagingFourier-6.2.so.6.2 (0x00007f00ee1a0000)
    libvtkalglib-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkalglib-6.2.so.6.2 (0x00007f00edf7c000)
    libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f00edd56000)
    libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007f00ec29e000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f00ec07c000)
    libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f00ebe6e000)
    libvtkImagingCore-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkImagingCore-6.2.so.6.2 (0x00007f00eba90000)

    What should I do next?
    Thanks in advance.


Log in to reply