Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Segmentation fault at start of program after change of dev machine
QtWS25 Last Chance

Segmentation fault at start of program after change of dev machine

Scheduled Pinned Locked Moved Solved Mobile and Embedded
10 Posts 4 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QtFriend
    wrote on last edited by QtFriend
    #1

    I just installed my qt cross development tools (for ARM) on a new laptop and compiled a test application.
    But I get the following error when I try to run the application on the target board with strace:

    
    # strace ./TestApp -qws
    execve("./TestApp", ["./TestApp", "-qws"], [/* 16 vars */]) = 0
    brk(0)                                  = 0x17000
    --- SIGSEGV (Segmentation fault) @ 0 (0) ---
    +++ killed by SIGSEGV +++
    Segmentation fault
    # 
    
    

    Are the wrong (x86 instead of ARM) libraries being linked into the application? Checked it, but looks fine.
    Or what could be the reason for this segfault?

    M 1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      What does file TestApp say?
      What does ldd TestApp say?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Q QtFriend

        I just installed my qt cross development tools (for ARM) on a new laptop and compiled a test application.
        But I get the following error when I try to run the application on the target board with strace:

        
        # strace ./TestApp -qws
        execve("./TestApp", ["./TestApp", "-qws"], [/* 16 vars */]) = 0
        brk(0)                                  = 0x17000
        --- SIGSEGV (Segmentation fault) @ 0 (0) ---
        +++ killed by SIGSEGV +++
        Segmentation fault
        # 
        
        

        Are the wrong (x86 instead of ARM) libraries being linked into the application? Checked it, but looks fine.
        Or what could be the reason for this segfault?

        M Offline
        M Offline
        mvuori
        wrote on last edited by
        #3

        Your test app may just have a bug... For example an uninitialised variable that in some cases works and in some cases not - meaning that the seg fault has nothing to do with the laptop as such. I would try with a very minimal test application that just returns from main without doing anything to verify that the basic dev system works.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          QtFriend
          wrote on last edited by QtFriend
          #4
          user@laptop:$ file TestApp
          TestApp: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
          
          user@laptop:$ ldd TestApp
          	not a dynamic executable
          
          user@laptop:$ arm-none-linux-gnueabi-readelf -a TestApp| grep "Shared library:"
           0x00000001 (NEEDED)                     Shared library: [libQtNetwork.so.4]
           0x00000001 (NEEDED)                     Shared library: [libQtCore.so.4]
           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]
          
          
          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            QtFriend
            wrote on last edited by
            #5

            @mvuori: this already is a minimal test application.
            This is the main code:

            #include <QtCore/QCoreApplication>
            #include "qdebug.h"
            
            int main(int argc, char *argv[])
            {
                QCoreApplication a(argc, argv);
            
                qDebug() << "test";
            
                return a.exec();
            }
            
            

            And this is the .pro file:

            
            QT       -= gui
            
            TARGET = TestApp
            CONFIG   += console
            CONFIG   -= app_bundle
            
            TEMPLATE = app
            
            
            SOURCES += main.cpp
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              What result do you have with ldd on your board ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • Q Offline
                Q Offline
                QtFriend
                wrote on last edited by
                #7

                I dont have ldd installed on the target board, but when I run LD_TRACE_LOADED_OBJECTS=1 instead, I get this output:

                # LD_TRACE_LOADED_OBJECTS=1 /root/TestApp
                Segmentation fault
                
                # LD_TRACE_LOADED_OBJECTS=1 /root/WorkingApp
                        libphonon.so.4 => /usr/lib/libphonon.so.4 (0x40ecf000)
                        libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x40f1e000)
                        libQtNetwork.so.4 => /usr/lib/libQtNetwork.so.4 (0x417bf000)
                        libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x418a4000)
                        libpthread.so.0 => /lib/libpthread.so.0 (0x41b91000)
                        /lib/ld-linux.so.3 (0x40000000)
                        ...
                # 
                
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  IIRC ldd is just a bash script that you can copy over to your board

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    QtFriend
                    wrote on last edited by
                    #9

                    I found the problem.

                    I used filezilla to copy my executable to the target board, and on my old machine transfer type was set to binary but on my new machine transfer type was still set to auto. After changing this to binary it worked.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Tricky one… Thanks for sharing !

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved