Segmentation fault at start of program after change of dev machine



  • 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?


  • Moderators

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



  • 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.



  • 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]
    
    


  • @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
    

  • Lifetime Qt Champion

    Hi,

    What result do you have with ldd on your board ?



  • 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)
            ...
    # 
    
    

  • Lifetime Qt Champion

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



  • 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.


  • Lifetime Qt Champion

    Tricky one… Thanks for sharing !


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.