Executable linked with Qt4 and Qt5, segmentation fault on start
-
Hi everyone,
I'm facing a problem i wasn't facing before and i don't know why.
I can launch my programs within QtCreator without any problem and everything works fine.
But nevertheless when i launch my .exe outside of it, i got Segmentation Fault (core dumped) everytime, when i ldd the .exe i got this output :linux-vdso.so.1 => (0x00007fff7d6f6000) librosbag_storage.so => /opt/ros/indigo/lib/librosbag_storage.so (0x00007f36065ea000) libroscpp_serialization.so => /opt/ros/indigo/lib/libroscpp_serialization.so (0x00007f36063e6000) librostime.so => /opt/ros/indigo/lib/librostime.so (0x00007f36061bc000) libcpp_common.so => /opt/ros/indigo/lib/libcpp_common.so (0x00007f3605fb4000) libqwt.so.6 => /usr/lib/libqwt.so.6 (0x00007f3605c99000) libQt5Widgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007f3605470000) libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007f3604e23000) libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f360477c000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3604478000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3604172000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3603f5b000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3603b96000) libconsole_bridge.so.0.2 => /usr/lib/x86_64-linux-gnu/libconsole_bridge.so.0.2 (0x00007f360398c000) libroslz4.so => /opt/ros/indigo/lib/libroslz4.so (0x00007f3603786000) libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f3603576000) libboost_system.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0 (0x00007f3603372000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3603153000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3602f4b000) libQtSvg.so.4 => /usr/lib/x86_64-linux-gnu/libQtSvg.so.4 (0x00007f3602cf4000) libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007f3602040000) libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007f3601b5b000) libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f360190a000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f3601601000) libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f36012cc000) libpng12.so.0 => /usr/lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f36010a6000) libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f3600e50000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3600c37000) libGL.so.1 => /usr/lib/nvidia-340/libGL.so.1 (0x00007f36008eb000) libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f36004e3000) libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f360016a000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f35fff66000) /lib64/ld-linux-x86-64.so.2 (0x000055a2b6b54000) liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f35ffd5c000) libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f35ffb20000) libaudio.so.2 => /usr/lib/x86_64-linux-gnu/libaudio.so.2 (0x00007f35ff907000) libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f35ff664000) libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f35ff45c000) libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f35ff23f000) libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f35ff02f000) libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f35fee25000) libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f35fec12000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f35fea0a000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f35fe7cb000) libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f35fe5ac000) libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f35fe386000) libnvidia-tls.so.340.96 => /usr/lib/nvidia-340/tls/libnvidia-tls.so.340.96 (0x00007f35fe182000) libnvidia-glcore.so.340.96 => /usr/lib/nvidia-340/libnvidia-glcore.so.340.96 (0x00007f35fb56e000) libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f35f9d00000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f35f9ad6000) libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007f35f9870000) libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f35f966b000) libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f35f9466000) libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f35f925f000)
I can see
libQtSvg.so.4 => /usr/lib/x86_64-linux-gnu/libQtSvg.so.4 (0x00007f3602cf4000)
libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007f3602040000)
libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007f3601b5b000)These libraries are from Qt4, the problem didn't appear before and i already had both versions installed..
If you have an hint or anything..
Thanks in advance -
Hi,
Against what version of Qt is your Qwt compiled against ?
-
Hi,
Thanks for your reply.
Well what you're asking is interesting because it made me notice that the above LDD output seems to indicate the qwt library linked to my .exe is not the one i indicate in my .pro ... This qwt is indeed compiled with Qt4 (i needed a version compiled for Qt4 for another purpose). But the qwt i link to my .exe in my .pro and project configuration is compiled with Qt5..
It's weird because i've got these lines in my .pro :win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../usr/local/qwt-6.1.2/lib/release/ -lqwt
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../usr/local/qwt-6.1.2/lib/debug/ -lqwt
else:unix: LIBS += -L$$PWD/../../../../usr/local/qwt-6.1.2/lib/ -lqwtINCLUDEPATH += $$PWD/../../../../usr/local/qwt-6.1.2/include
DEPENDPATH += $$PWD/../../../../usr/local/qwt-6.1.2/includeAnd in the "Projects" section of QtCreator, i only added /usr/local/qwt-6.1.2/lib/ to LD_LIBRARY_PATH, not /usr/lib
-
I've just been trying to remove the libqwt.so.6 file from /usr/lib to see if the linking would work, but still not.
LDD says /usr/lib/libqwt.so.6 is not found, but the Qt4 dependencies are not displayed anymore so i guess the problem is there.. -
Setting LD_LIBRARY_PATH should be enough to cover that. Where did you set it ? In the Run part of the Project panel ?
-
Hi,
I solved my problem, i did set the LD_LIBRARY_PATH in QtCreator, but when i launched the app in the terminal, the LD_LIBRARY_PATH wasn't set properly so i did an .sh to launch the exe containing the right LD_LIBRARY_PATH.
Thanks for pointing me to the qwt thing