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 on dummy app
Forum Updated to NodeBB v4.3 + New Features

Segmentation fault on dummy app

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
imx6yocto
14 Posts 4 Posters 6.2k Views 2 Watching
  • 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.
  • V VincentB
    16 Jun 2016, 07:21

    Hi,

    My program exits with a segmentation fault and I don't know why ...

    #include <QApplication>
    #include <QTimer>
    #include <QDebug>
     
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
     
        QTimer::singleShot( 2000, &app, SLOT( quit() ) );
     
        qDebug() << "app.exec() return code :" << app.exec();
    }
    

    The printed messages are :

    app.exec() return code : 0
    *** Error in `./sans_titre': free(): invalid pointer: 0x6bd00040 ***
    Aborted
    
    

    Where is the problem ?

    I run it on an imx6 board using a yocto environment (jethro branch).
    My conf :

    MACHINE ?= 'apalis-imx6'
    DISTRO ?= 'poky'
    PACKAGE_CLASSES ?= "package_rpm"
    EXTRA_IMAGE_FEATURES = "debug-tweaks ssh-server-openssh"
    USER_CLASSES ?= "buildstats image-mklibs"
    PATCHRESOLVE = "noop"
    BB_DISKMON_DIRS = "\
        STOPTASKS,${TMPDIR},1G,100K \
        STOPTASKS,${DL_DIR},1G,100K \
        STOPTASKS,${SSTATE_DIR},1G,100K \
        STOPTASKS,/tmp,100M,100K \
        ABORT,${TMPDIR},100M,1K \
        ABORT,${DL_DIR},100M,1K \
        ABORT,${SSTATE_DIR},100M,1K \
        ABORT,/tmp,10M,1K"
    PACKAGECONFIG_append_pn-qemu-native = " sdl"
    PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
    ASSUME_PROVIDED += "libsdl-native"
    CONF_VERSION = "1"
    LICENSE_FLAGS_WHITELIST = "commercial"
    
    DL_DIR ?= "${BSPDIR}/downloads/"
    
    IMAGE_INSTALL_append = " gcc g++ binutils libgcc libgcc-dev libstdc++ libstdc++-dev libstdc++-staticdev \
    autoconf automake ccache chkconfig glib-networking glibmm \
    packagegroup-core-buildessential pkgconfig  \
    boost cmake zlib glib-2.0 packagegroup-fsl-tools-testapps  \
        cpufrequtils \
        nano \
        gdb \
        openssh-sftp-server \
        imx-vpu \
        imx-test \
        firmware-imx \
        qtbase-fonts \
        qtbase-plugins \
        qtbase-tools \
        qtdeclarative \
        qtdeclarative-plugins \
        qtdeclarative-tools \
        qtdeclarative-qmlplugins \
        qtimageformats-plugins \
        qtsystems \
        qtsystems-tools \
        qtsystems-qmlplugins \
        qtgraphicaleffects-qmlplugins \
        qtconnectivity-qmlplugins \
        cairo pango fontconfig freetype pulseaudio dbus \
        i2c-tools \ 
        gstreamer1.0-plugins-imx \
        gst1.0-fsl-plugin \
        gstreamer1.0-plugins-base \
        gstreamer1.0-plugins-good \
        gstreamer1.0-plugins-good-apps \
        gstreamer1.0-plugins-base-apps \
        gstreamer1.0-libav \
        psplash \
        u-boot-toradex-fsl-fw-utils \
    "
    
    DISTRO_FEATURES_remove = "x11 wayland"
    IMAGE_INSTALL_remove = "eglinfo-x11"
    IMAGE_FEATURES += "dev-pkgs tools-debug"
    KERNEL_IMAGETYPE = "uImage"
    ACCEPT_FSL_EULA = "1"
    IMAGE_FSTYPES += "ext3"
    

    Thanks for your help...

    Regards,

    M Offline
    M Offline
    micland
    wrote on 16 Jun 2016, 11:15 last edited by micland
    #3

    @VincentB said:

    The printed messages are :

    app.exec() return code : 0
    app.exec() return code : 0
    *** Error in `./sans_titre': free(): invalid pointer: 0x6bd00040 ***
    Aborted
    

    do you really get the debug output twice when running the app once?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VincentB
      wrote on 16 Jun 2016, 11:18 last edited by
      #4

      No I did a mistake when I copy/paste

      1 Reply Last reply
      0
      • R raven-worx
        16 Jun 2016, 11:01

        @VincentB
        did you compile Qt yourself?
        Please also post the stack trace of the crash

        V Offline
        V Offline
        VincentB
        wrote on 16 Jun 2016, 11:28 last edited by
        #5

        @raven-worx ,

        Qt has been compiled by yocto.

        What steps I have to follow to have a stack trace ?

        R 1 Reply Last reply 17 Jun 2016, 05:46
        0
        • M Offline
          M Offline
          micland
          wrote on 16 Jun 2016, 11:30 last edited by
          #6

          @VincentB
          As I see you use QApplication which is designed for GUI apps. I don't think that this is the reason but can you try to replace QApplication with QCoreApplication and repeat the test?

          Footnote: I can't reproduce the error with Qt 5.5 on Ubuntu (no crash).

          V 1 Reply Last reply 16 Jun 2016, 12:09
          0
          • M micland
            16 Jun 2016, 11:30

            @VincentB
            As I see you use QApplication which is designed for GUI apps. I don't think that this is the reason but can you try to replace QApplication with QCoreApplication and repeat the test?

            Footnote: I can't reproduce the error with Qt 5.5 on Ubuntu (no crash).

            V Offline
            V Offline
            VincentB
            wrote on 16 Jun 2016, 12:09 last edited by
            #7

            @micland ,

            With QCoreApplication, there is no problem. What could we conclude ?

            M K 2 Replies Last reply 16 Jun 2016, 12:43
            0
            • V VincentB
              16 Jun 2016, 12:09

              @micland ,

              With QCoreApplication, there is no problem. What could we conclude ?

              M Offline
              M Offline
              micland
              wrote on 16 Jun 2016, 12:43 last edited by
              #8

              @VincentB said:

              With QCoreApplication, there is no problem. What could we conclude ?

              Fine - we found a solution :) But I have no idea what the problem is. QApplication inherits QGuiApplication which inherits QCoreApplication. In my opinion the child classes just add additional GUI related functionality but should not have different behaviour (and shall not have following the Liskov substitution principle).
              The documentation only says that QCoreApplication should be used for non-GUI applications because it has no dependencies to QWidgets. But there is no note that you have to use only QCoreApplication.
              Perhaps someone else here knows more about the internas of the three classes?

              1 Reply Last reply
              0
              • V VincentB
                16 Jun 2016, 12:09

                @micland ,

                With QCoreApplication, there is no problem. What could we conclude ?

                K Offline
                K Offline
                kshegunov
                Moderators
                wrote on 16 Jun 2016, 13:52 last edited by
                #9

                @VincentB @micland
                Well,
                QCoreApplication does almost nothing - it starts an event loop, while QApplication is fat and heavy and loads plugins and platform integrations and widgety things, so it may simply be a bug. But in any case @raven-worx's request is relevant, you should obtain a stack trace from the crash (how depends on the IDE and its setup).

                Kind regards.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  VincentB
                  wrote on 16 Jun 2016, 15:58 last edited by VincentB
                  #10

                  Ok,

                  I''ve done this test cause on my main gui application I've got the same problem. Now, I'll search how to get a good stack trace to poste here (Unless you can advice me on how to do that).

                  1 Reply Last reply
                  0
                  • V VincentB
                    16 Jun 2016, 11:28

                    @raven-worx ,

                    Qt has been compiled by yocto.

                    What steps I have to follow to have a stack trace ?

                    R Offline
                    R Offline
                    raven-worx
                    Moderators
                    wrote on 17 Jun 2016, 05:46 last edited by
                    #11

                    @VincentB
                    from where do you have the console output? From your IDE?
                    If so there should also be a window which shows the stack trace at the time of the crash.

                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                    If you have a question please use the forum so others can benefit from the solution in the future

                    V 1 Reply Last reply 17 Jun 2016, 12:51
                    0
                    • R raven-worx
                      17 Jun 2016, 05:46

                      @VincentB
                      from where do you have the console output? From your IDE?
                      If so there should also be a window which shows the stack trace at the time of the crash.

                      V Offline
                      V Offline
                      VincentB
                      wrote on 17 Jun 2016, 12:51 last edited by
                      #12

                      @raven-worx ,

                      Hi, ok, I'll check this

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        VincentB
                        wrote on 17 Jun 2016, 13:14 last edited by
                        #13

                        Sorry but I'm not sure to find where to find this stack window .. (I'm using qtcreator 3.6.0)

                        R 1 Reply Last reply 20 Jun 2016, 06:09
                        0
                        • V VincentB
                          17 Jun 2016, 13:14

                          Sorry but I'm not sure to find where to find this stack window .. (I'm using qtcreator 3.6.0)

                          R Offline
                          R Offline
                          raven-worx
                          Moderators
                          wrote on 20 Jun 2016, 06:09 last edited by raven-worx
                          #14

                          @VincentB said:

                          Sorry but I'm not sure to find where to find this stack window .. (I'm using qtcreator 3.6.0)

                          see this.

                          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                          If you have a question please use the forum so others can benefit from the solution in the future

                          1 Reply Last reply
                          0

                          12/14

                          17 Jun 2016, 12:51

                          • Login

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