Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Linux application crashes.
Forum Updated to NodeBB v4.3 + New Features

Linux application crashes.

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 3 Posters 2.1k 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.
  • J jenya7

    @jsulm said in Linux application crashes.:

    @jenya7 said in Linux application crashes.:

    The exception arises at _start function, it's before my app comes in play as I understand.

    Could indicate that some libs or Qt plug-ins are not found/loaded.
    Set QT_DEBUG_PLUGINS in Run settings of your app and see what output you get (you can also post it here).
    How did you install Qt?

    I installed it like this

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install qt5-default
    sudo apt-get install qtcreator
    sudo apt-get install qtdeclarative5-dev
    sudo apt-get install qtbase5-examples
    sudo apt-get install qtbase5-doc-html
    

    I found a widget app, I created several months ago - it runs, no problem. It also has in a *.pro file
    QT += core
    QT += network
    QT += xml
    I thought one of these causes the problem.
    How do I set QT_DEBUG_PLUGINS?

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #10

    @jenya7 said in Linux application crashes.:

    How do I set QT_DEBUG_PLUGINS?

    Right side in QtCreator->Projects->Run->Run Environment, then add there QT_DEBUG_PLUGINS with value 1.

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

    1 Reply Last reply
    0
    • J jenya7

      @JonB said in Linux application crashes.:

      @jenya7 said in Linux application crashes.:

      And it's perfectly right - it's data encapsulation

      No, having global/static objects is not a great idea. In any case, as I said a large number of Qt objects cannot/must not be defined as static/global, because they cannot be instantiated before QCoreApplication has been created, whether you think that is a good idea or not.

      Try this now for your test program:

      #include <stdio.h>
      
      int main(int argc, char *argv[])
      {  
          printf ("Hello World\n");
          return 0;
      }
      

      If that gives the same behaviour --- as I am hoping it will, then you know you do not have a Qt issue.

      The same problem.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #11

      @jenya7
      As I suspected :( You could now also remove the #include <stdio.h> and the printf() just to rule out any possible I/O issue.

      Assuming that too fails, you have a problem!

      What Linux are you on, are you fully patched, I assume your gcc came with the OS, does that need updating?

      Since this means you cannot run any C/C++ program, how long has this been happening to you? Is this the first time you have ever tried, or did it use to work but not now?

      Experiments with Qt and QT_DEBUG_PLUGINS are now pointless, since your fault occurs with nothing Qt in your program. You should even be able to compile the minimal program with just gcc file.c and then run the executable (a.out), so not even using anything Qt to build.

      Try compiling for Release versus Debug, does that make any difference? Try running your executable from the command-line, not from Qt Creator, does that make any difference?

      J 1 Reply Last reply
      0
      • JonBJ JonB

        @jenya7
        As I suspected :( You could now also remove the #include <stdio.h> and the printf() just to rule out any possible I/O issue.

        Assuming that too fails, you have a problem!

        What Linux are you on, are you fully patched, I assume your gcc came with the OS, does that need updating?

        Since this means you cannot run any C/C++ program, how long has this been happening to you? Is this the first time you have ever tried, or did it use to work but not now?

        Experiments with Qt and QT_DEBUG_PLUGINS are now pointless, since your fault occurs with nothing Qt in your program. You should even be able to compile the minimal program with just gcc file.c and then run the executable (a.out), so not even using anything Qt to build.

        Try compiling for Release versus Debug, does that make any difference? Try running your executable from the command-line, not from Qt Creator, does that make any difference?

        J Offline
        J Offline
        jenya7
        wrote on last edited by jenya7
        #12

        @JonB
        From a build folder it runs good.
        Non-debug run - also good.
        It happens only in Debug run.

        JonBJ 2 Replies Last reply
        0
        • J jenya7

          @JonB
          From a build folder it runs good.
          Non-debug run - also good.
          It happens only in Debug run.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #13

          @jenya7
          For your test program you don't need anything Qt. Remove all those QT += core-type lines from .pro file. Runs OK from command-line, outside Creator? Errors only when run inside Creator? From Creator, when you run it have you tried both "Run without debugging" and "Run with debugger"?

          1 Reply Last reply
          0
          • J jenya7

            @JonB
            From a build folder it runs good.
            Non-debug run - also good.
            It happens only in Debug run.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #14

            @jenya7 said in Linux application crashes.:

            It happens only in Debug run.

            Try running it under gdb from outside Qt Creator. From a command-line you can just go:

            gdb /full/path/to/executable
            

            and then IIRC type run<RETURN> inside gdb prompt.

            J 1 Reply Last reply
            0
            • JonBJ JonB

              @jenya7 said in Linux application crashes.:

              It happens only in Debug run.

              Try running it under gdb from outside Qt Creator. From a command-line you can just go:

              gdb /full/path/to/executable
              

              and then IIRC type run<RETURN> inside gdb prompt.

              J Offline
              J Offline
              jenya7
              wrote on last edited by
              #15

              @JonB said in Linux application crashes.:

              @jenya7 said in Linux application crashes.:

              It happens only in Debug run.

              Try running it under gdb from outside Qt Creator. From a command-line you can just go:

              gdb /full/path/to/executable
              

              and then IIRC type run<RETURN> inside gdb prompt.

              This way it runs good.

              JonBJ 1 Reply Last reply
              0
              • J jenya7

                @JonB said in Linux application crashes.:

                @jenya7 said in Linux application crashes.:

                It happens only in Debug run.

                Try running it under gdb from outside Qt Creator. From a command-line you can just go:

                gdb /full/path/to/executable
                

                and then IIRC type run<RETURN> inside gdb prompt.

                This way it runs good.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #16

                @jenya7
                So if this is all true, and you have tried the various suggestions for within Creator, it looks like there is some problem when Creator invoked gdb, doesn't it?

                I don't know what is wrong. You could check your version of Creator is up-to-date. And that the kit is running the desired gdb executable. I suppose you might try uninstalling and reinstalling Creator, just in case. Until someone else posts a better solutuon.

                J 1 Reply Last reply
                0
                • JonBJ JonB

                  @jenya7
                  So if this is all true, and you have tried the various suggestions for within Creator, it looks like there is some problem when Creator invoked gdb, doesn't it?

                  I don't know what is wrong. You could check your version of Creator is up-to-date. And that the kit is running the desired gdb executable. I suppose you might try uninstalling and reinstalling Creator, just in case. Until someone else posts a better solutuon.

                  J Offline
                  J Offline
                  jenya7
                  wrote on last edited by
                  #17

                  @JonB
                  An old project runs good in Debug run.

                  JonBJ 1 Reply Last reply
                  0
                  • J jenya7

                    @JonB
                    An old project runs good in Debug run.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #18

                    @jenya7
                    Then create a brand new tiny test project from scratch and try that. If that works, go back to existing project and delete everything from the build output directory, run qmake and re-build, maybe that will clear it up?

                    J 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @jenya7
                      Then create a brand new tiny test project from scratch and try that. If that works, go back to existing project and delete everything from the build output directory, run qmake and re-build, maybe that will clear it up?

                      J Offline
                      J Offline
                      jenya7
                      wrote on last edited by
                      #19

                      Very peculiar. If I create a widget app - all is good, it runs in Debug. A console app just created, no files or libs added - generates the problem.

                      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