segmentation fault


  • Qt Champions 2018

    @Milav In gdb enter bt and press enter after your app crashed



  • @jsulm

    i enter the gdb command as following .

    tdp0009@tdp0009-desktop:~/Teq_Projects/Aug_2019/HMI/Firmware/QT/Desktop_Application/11-oct/qt-mqtt-example/build-qt-mosquitto-Desktop-Release$ gdb qt-mosquitto 
    GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
    Copyright (C) 2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from qt-mosquitto...(no debugging symbols found)...done.
    (gdb) bt
    No stack.
    (gdb) 
    No stack.
    (gdb)
    


  • @Milav
    Type run first to run your program! Then if it crashes type bt. You could type man gdb from the command-line, or help from within gdb like the message states. We had to learn to do that....



  • @JonB

    thank you for your help.

    i run gdb from development host machine.

    here i send the output of that.

    tdp0009@tdp0009-desktop:~/Teq_Projects/Aug_2019/HMI/Phytec_Toolchain/arm-cortexa8-linux-gnueabihf/bin$ ./arm-cortexa8-linux-gnueabihf-gdb
    GNU gdb (GDB) 7.5
    Copyright (C) 2012 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "--host=i686-host-linux-gnu --target=arm-cortexa8-linux-gnueabihf".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    (gdb) target extended 192.168.5.52:2345
    Remote debugging using 192.168.5.52:2345
    (gdb) set remote exec-file /opt/milav/qt-mosquitto
    (gdb) run
    Starting program:  
    
    Program received signal SIGILL, Illegal instruction.
    0x404df208 in ?? ()
    (gdb) bt
    #0  0x404df208 in ?? ()
    Cannot access memory at address 0x0
    #1  0x404092c0 in ?? ()
    Cannot access memory at address 0x0
    #2  0x404092c0 in ?? ()
    Cannot access memory at address 0x0
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)
    (gdb) 
    

    i think you got what you want.

    looking forward hearing from you.


  • Qt Champions 2018

    @Milav said in segmentation fault:

    i think you got what you want

    Not really.
    Did you build the app in debug mode?



  • @jsulm said in segmentation fault:

    Did you build the app in debug mode?

    yes i build the app in debug mode.



  • @Milav said in segmentation fault:

    Link :- Ref. Link

    Could it be possible that you run such example AS IS, I mean just download/clone the code and try such example without any change.
    If you manage to make it work, then you'll have the foundation to start adapting it to whatever you need/desire.

    In addition, is there any compelling reason not to use the Qt MQTT module?
    Have you try any of the Qt MQTT examples?



  • @Pablo-J-Rogina said in segmentation fault:

    In addition, is there any compelling reason not to use the Qt MQTT module?
    Have you try any of the Qt MQTT examples?

    I use actually qt4.8.7 source for development so QMqtt is not build for this qt version, so that i do not use qmqtt class.

    if you have any idea how to run QMqtt in qt 4.8.7 source than please tell me it is so helpful to me.

    @Pablo-J-Rogina said in segmentation fault:

    Could it be possible that you run such example AS IS, I mean just download/clone the code and try such example without any change.
    If you manage to make it work, then you'll have the foundation to start adapting it to whatever you need/desire.

    i actually tried same as is code for pc development and that is work fine.

    but when i cross compiling the code for embedded target board than it gives segmentation error,

    the difference between host pc and Embedded target board is only QT source.

    Host pc => qmake (qt version 5.4.0 )
    Embedded target => qmake (qt version 4.8.7)

    hope you got my point.

    if you have any query please tell me.

    and please guys help me to sort out the problem.

    i am also try another code for the same , but in that i have also suffer same problem.

    Another code link :- link text


  • Qt Champions 2018

    @Milav OK, maybe we should start from the beginning.
    Do you cross compile from PC to device?
    Does the app crash in same way on host with Qt5?
    Is it possible that you're mixing Qt4 and Qt5 on your target device? You can check this using "ldd EXECUTABLE" on your target.
    Please do this on your target (in a terminal):

    file /opt/milav/qt-mosquitto
    ldd /opt/milav/qt-mosquitto
    

    and post the output here.



  • @jsulm said in segmentation fault:

    OK, maybe we should start from the beginning.

    Okay sure.

    @jsulm said in segmentation fault:

    Do you cross compile from PC to device?

    Yes i cross compile the "qt-mosquitto" application for target (device) from qt creator (that is install on pc).

    For cross compilng i have use qmake version 4.8.7.

    and qt creator version is "Qt Creator 3.3.0 (opensource)"

    and for v

    @jsulm said in segmentation fault:

    Does the app crash in same way on host with Qt5?

    No, the application is not crash in PC.

    In pc i have use same code but qmake vwersion is 5.4.0

    @jsulm said in segmentation fault:

    Is it possible that you're mixing Qt4 and Qt5 on your target device? You can check this using "ldd EXECUTABLE" on your target.

    In target i have only qt 4 library and qmake are there.
    i think there is no qt 5 component in target device.

    @jsulm said in segmentation fault:

    Please do this on your target (in a terminal):

    sorry for this, but i have not ldd command on target device.
    if it is necessary than tell i have install and cross compile it for target device.

    sorry i dont know why this ldd cmd is not there in target device.


  • Qt Champions 2018

    @Milav said in segmentation fault:

    sorry i dont know why this ldd cmd is not there in target device

    This is not unusual. On limited devices manufacturers usually remove everything not needed when using the device.
    Is "file" command there?



  • @jsulm said in segmentation fault:

    This is not unusual. On limited devices manufacturers usually remove everything not needed when using the device.
    Is "file" command there?

    Okay no problem.

    actually "file" cmd also not in target device.

    but in desktop pc i have "file" cmd so i execute file cmd with binary application file.

    here i have show output of that .

    tdp0009@tdp0009-desktop:~$ file qt-mosquitto 
    qt-mosquitto: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, not stripped
    
    

    i think you got your answer from above result.


  • Qt Champions 2018

    @Milav said in segmentation fault:

    32-bit LSB executable, ARM, EABI5

    Looks good if that's what your target device CPU is



  • @jsulm said in segmentation fault:

    Looks good if that's what your target device CPU is

    yes. it is ARM based 32-bit CPU.



  • @jsulm said in segmentation fault:

    ldd /opt/milav/qt-mosquitto

    hello ,

    i explore and find some of the cmd for ldd.

    here i have show the output for ldd qt-mosquitto/

      Shared library: [libmosquittopp.so.1]
     0x00000001 (NEEDED)                     Shared library: [libmosquitto.so.1]
     0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
     0x00000001 (NEEDED)                     Shared library: [librt.so.1]
     0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
     0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
     0x00000001 (NEEDED)                     Shared library: [libm.so.6]
     0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
     0x00000001 (NEEDED)                     Shared library: [libc.so.6]
     0x00000001 (NEEDED)                     Shared library: [ld-linux-armhf.so.3]
    
    

    hope now you got your answer.



  • @jsulm

    Hello, have you got any solution?


  • Qt Champions 2018

    @Milav Did you try to cross compile a simple application and run it on your device?



  • @jsulm

    yes, without mqtt module , i tried lot of application and it is working very fine..


  • Qt Champions 2018

    @Milav Then I suggest to start with a minimal application and add mqtt functionality in small pieces to see when it starts to crash.



  • @Milav said in segmentation fault:

    the difference between host pc and Embedded target board is only QT source.
    Host pc => qmake (qt version 5.4.0 )
    Embedded target => qmake (qt version 4.8.7)

    You should have stated these settings from the very beginning... :-)

    Anyway, could it be possible that you build Qt 4.8.7 for PC (host) and build your example again with that Qt version and run in PC to see what happens.