Important: Please read the Qt Code of Conduct -

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 : =>  (0x00007fff7d6f6000) => /opt/ros/indigo/lib/ (0x00007f36065ea000) => /opt/ros/indigo/lib/ (0x00007f36063e6000) => /opt/ros/indigo/lib/ (0x00007f36061bc000) => /opt/ros/indigo/lib/ (0x00007f3605fb4000) => /usr/lib/ (0x00007f3605c99000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3605470000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3604e23000) => /usr/lib/x86_64-linux-gnu/ (0x00007f360477c000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3604478000) => /lib/x86_64-linux-gnu/ (0x00007f3604172000) => /lib/x86_64-linux-gnu/ (0x00007f3603f5b000) => /lib/x86_64-linux-gnu/ (0x00007f3603b96000) => /usr/lib/x86_64-linux-gnu/ (0x00007f360398c000) => /opt/ros/indigo/lib/ (0x00007f3603786000) => /lib/x86_64-linux-gnu/ (0x00007f3603576000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3603372000) => /lib/x86_64-linux-gnu/ (0x00007f3603153000) => /lib/x86_64-linux-gnu/ (0x00007f3602f4b000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3602cf4000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3602040000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3601b5b000) => /usr/lib/x86_64-linux-gnu/ (0x00007f360190a000) => /lib/x86_64-linux-gnu/ (0x00007f3601601000) => /usr/lib/x86_64-linux-gnu/ (0x00007f36012cc000) => /usr/lib/x86_64-linux-gnu/ (0x00007f36010a6000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3600e50000) => /lib/x86_64-linux-gnu/ (0x00007f3600c37000) => /usr/lib/nvidia-340/ (0x00007f36008eb000) => /usr/lib/x86_64-linux-gnu/ (0x00007f36004e3000) => /usr/lib/x86_64-linux-gnu/ (0x00007f360016a000) => /lib/x86_64-linux-gnu/ (0x00007f35fff66000)
    /lib64/ (0x000055a2b6b54000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35ffd5c000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35ffb20000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35ff907000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35ff664000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35ff45c000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35ff23f000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35ff02f000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35fee25000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35fec12000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35fea0a000) => /lib/x86_64-linux-gnu/ (0x00007f35fe7cb000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35fe5ac000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35fe386000) => /usr/lib/nvidia-340/tls/ (0x00007f35fe182000) => /usr/lib/nvidia-340/ (0x00007f35fb56e000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35f9d00000) => /lib/x86_64-linux-gnu/ (0x00007f35f9ad6000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35f9870000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35f966b000) => /lib/x86_64-linux-gnu/ (0x00007f35f9466000) => /usr/lib/x86_64-linux-gnu/ (0x00007f35f925f000)

    I can see => /usr/lib/x86_64-linux-gnu/ (0x00007f3602cf4000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3602040000) => /usr/lib/x86_64-linux-gnu/ (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

  • Lifetime Qt Champion


    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/ -lqwt

    INCLUDEPATH += $$PWD/../../../../usr/local/qwt-6.1.2/include
    DEPENDPATH += $$PWD/../../../../usr/local/qwt-6.1.2/include

    And 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 file from /usr/lib to see if the linking would work, but still not.
    LDD says /usr/lib/ is not found, but the Qt4 dependencies are not displayed anymore so i guess the problem is there..

  • Lifetime Qt Champion

    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

Log in to reply