QEventLoop: Cannot be used without QApplication Qt static
-
@dheerendra
That the first step I did after building Qt static I built a console application to test it and it ran with no problem then I ran SignalR tester to test SignalR and it ran without problems.
I tried handling destroyed and "I am dying" never appeared as it should.
I debugged the code in RunSDK method until the error appeared at a get function in SignalR code for getting a url. -
@Mohammedbie said in QEventLoop: Cannot be used without QApplication Qt static:
SignalR code for getting a url.
Do you mean that here you are using some QNework* classes to post the URL and get the response from webserver ?
-
I sill can't understand what cause this in Qt static and not in Qt dynamic of the same version as the code in the two cases the same .
@Mohammedbie said in QEventLoop: Cannot be used without QApplication Qt static:
I sill can't understand what cause this in Qt static and not in Qt dynamic of the same version as the code in the two cases the same .
The source may be the same, the way the generated binary/ies are run is different. The most significant difference is with globals/statics initialization. So if you have such, check them first.
Important:QCoreApplication
must be the firstQObject
to be created and the last destroyed, which means you can't have globalQObject
s.That's the best I can give you without source code or a stack trace (e.g. running a debug build with
QT_FATAL_WARNINGS=1
), or any additional information; I'm not about to just guess semi-randomly. -
@dheerendra
Yes indeed and I tried opening the Last Get function in Qt creator but it didn't open so I couldn't trace at which line exactly in this function the error generated but I traced with "qDebug"s to it. -
I will check for global QObject s and Will give a stack trace as soon as possible.
-
Stack trace :
1 __GI_raise raise.c 51 0x7f5666f8ce97 2 __GI_abort abort.c 79 0x7f5666f8e801 3 qt_message_fatal qlogging.cpp 1680 0x7f566839a31e 4 QMessageLogger::warning qlogging.cpp 560 0x7f566839596d 5 QEventLoop::QEventLoop qeventloop.cpp 103 0x7f56685265cc 6 QThread::exec qthread.cpp 506 0x7f56683a1e6d 7 QThread::run qthread.cpp 574 0x7f56683a2068 8 QThreadPrivate::start qthread_unix.cpp 344 0x7f56683aa1a1 9 start_thread pthread_create.c 463 0x7f56673466db 10 clone clone.S 95 0x7f566706f88f
The error message is generated in a get function for QNetworkAccessManager in SignalR.
-
I tried something new , I tried building the SDK as a static library and it ran with Qt 5.7.0 static with no error on linux what can cause this ?
-
Any thought ?
-
Hi, just guessing but the
QCoreApplication a(argc, argv);
call loads lots of stuff, like the Qt plugins, and if something fails your thread might start anyway, giving you that error because no healthy QCoreApplication is seen by the thread. Static builds depend on all the plugins are linked in properly, so it could be something missing for a static build (but the .so files are all present so your dynamic build runs fine). -
@hskoglund
Thanks for the reply. Will check the plugins built with Qt static and see if it built with success.