Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Segmentation fault at start of program after change of dev machine

    Mobile and Embedded
    4
    10
    1694
    Loading More Posts
    • 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
      QtFriend last edited by 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 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion last edited by

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

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

        1 Reply Last reply Reply Quote 0
        • M
          mvuori @QtFriend last edited by

          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 Reply Quote 0
          • Q
            QtFriend last edited by QtFriend

            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 Reply Quote 0
            • Q
              QtFriend last edited by

              @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 Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                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 Reply Quote 0
                • Q
                  QtFriend last edited by

                  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 Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    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 Reply Quote 0
                    • Q
                      QtFriend last edited by

                      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 Reply Quote 0
                      • SGaist
                        SGaist Lifetime Qt Champion last edited by

                        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 Reply Quote 0
                        • First post
                          Last post