Unsolved Linux application crashes.
-
@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? -
@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.
-
@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.
-
@jenya7
As I suspected :( You could now also remove the#include <stdio.h>
and theprintf()
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 justgcc 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?
-
@JonB
From a build folder it runs good.
Non-debug run - also good.
It happens only in Debug run. -
@jenya7
For your test program you don't need anything Qt. Remove all thoseQT += 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"? -
@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. -
@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.
-
@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.
-
@JonB
An old project runs good in Debug run. -
@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, runqmake
and re-build, maybe that will clear it up? -
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.