QT Debugging fails on Windows
-
Yes, the project definitely uses the web engine. The app displays transit routes on Google Maps in a webengine view or a browser window. The source is on github: Mapper
I thought earlier today that size might be pat of the problem, particularly since several sqlite database files are included as qrc resources but removing them made no difference.
I normally use Ubuntu but wish to share the progam so I have to know port it to Windows and MacOS. Mac OS is the reason why those files are included as qrc resources as it simplifies creating an installer for the MacOS port. There may be a better way to install the databases on MacOS but I haven't wanted to spend the time to research how to do it. I have never used Apple computes so I am a complete newbie there.
Up until a few days ago, I had no problems with Windows and posted a windows installer for a friend which you can download here.
-
Yes, the project definitely uses the web engine. The app displays transit routes on Google Maps in a webengine view or a browser window. The source is on github: Mapper
I thought earlier today that size might be pat of the problem, particularly since several sqlite database files are included as qrc resources but removing them made no difference.
I normally use Ubuntu but wish to share the progam so I have to know port it to Windows and MacOS. Mac OS is the reason why those files are included as qrc resources as it simplifies creating an installer for the MacOS port. There may be a better way to install the databases on MacOS but I haven't wanted to spend the time to research how to do it. I have never used Apple computes so I am a complete newbie there.
Up until a few days ago, I had no problems with Windows and posted a windows installer for a friend which you can download here.
If the debugger crashes ... sucks.
You could try https://download.qt.io/snapshots/qtcreator/13.0/13.0.0-beta1/
There we bundle
lldb.exe
, which should be able to debug MSVC projects.I don't know if it fares better.
We plan to offer this as an alternative to cdb.
-
If the debugger crashes ... sucks.
You could try https://download.qt.io/snapshots/qtcreator/13.0/13.0.0-beta1/
There we bundle
lldb.exe
, which should be able to debug MSVC projects.I don't know if it fares better.
We plan to offer this as an alternative to cdb.
@cristian-adam I don't know if the beta version of Qt Creator would help. Maybe you missed the fact that the program won't run in non debug mode either. I will give it a try.
-
@cristian-adam I don't know if the beta version of Qt Creator would help. Maybe you missed the fact that the program won't run in non debug mode either. I will give it a try.
-
-
The program compiles and links ok but will not run
Aaah. I was thinking was about the crashing in debug mode.
See this thread https://forum.qt.io/post/769276 for information about how to debug a Qt application that doesn't start.
In this case was Qt Creator, but you can adapt to your case.
-
The program compiles and links ok but will not run
Aaah. I was thinking was about the crashing in debug mode.
See this thread https://forum.qt.io/post/769276 for information about how to debug a Qt application that doesn't start.
In this case was Qt Creator, but you can adapt to your case.
You could also enable mini dump crash files for Windows, see https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
Then load the said
dmp
file into Qt Creator usinglldb.exe
from Qt Creator 13. See https://bugreports.qt.io/browse/QTCREATORBUG-29423 for more details. -
You could also enable mini dump crash files for Windows, see https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
Then load the said
dmp
file into Qt Creator usinglldb.exe
from Qt Creator 13. See https://bugreports.qt.io/browse/QTCREATORBUG-29423 for more details.@cristian-adam I took a look at what was required to build Qt Creator from source an it appeared to be rather involved with the need to install LLVM and other prerequisites so I decided to wait until I was fresh. I'll give it a try later this morning.
In the meantime, I am investigating whether the problem involves some code I have to create a Sqlite3 User Defined Procedure. In order to do this, I need to include sqlite3.c and sqlite3.h in the program. The problem may be a discrepancy between the version of Sqlite3 in the Qt distribution and what I am compiling with. In qmake (my .pro file), I can say:
SOURCES += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.c HEADERS += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h
but I'm trying to figure out where I have
include "sqlite3.h"
in my .cpp file to include the correct version . Maybe I can create a define in the .pro file to do this?
Anyway, thanks for your continued attention and help.
-
@cristian-adam I took a look at what was required to build Qt Creator from source an it appeared to be rather involved with the need to install LLVM and other prerequisites so I decided to wait until I was fresh. I'll give it a try later this morning.
In the meantime, I am investigating whether the problem involves some code I have to create a Sqlite3 User Defined Procedure. In order to do this, I need to include sqlite3.c and sqlite3.h in the program. The problem may be a discrepancy between the version of Sqlite3 in the Qt distribution and what I am compiling with. In qmake (my .pro file), I can say:
SOURCES += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.c HEADERS += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h
but I'm trying to figure out where I have
include "sqlite3.h"
in my .cpp file to include the correct version . Maybe I can create a define in the .pro file to do this?
Anyway, thanks for your continued attention and help.
You don't need to build Qt Creator in order to debug why your application doesn't start.
You can do the following things to find out what's going on with mapper.exe.
Getting access to the Qt logs
- Set the environment variable
QT_LOGGING_RULES=qt*=true
- Start DebugView to capture the debug log messages
- Start mapper.exe
Hopefully something will pop up in the DebugView
Errors reported by the operating system
In the Windows "Event Viewer" application in the "Windows Logs" category usually the "Application" and "System" contain traces that might help pinpoint the failure
Taking mapper.exe startup under the magnifying glass
Using Process Monitor and filtering after
mapper.exe
you can find out all the file access, registry access and so forth.Good luck finding the root cause.
- Set the environment variable
-
You don't need to build Qt Creator in order to debug why your application doesn't start.
You can do the following things to find out what's going on with mapper.exe.
Getting access to the Qt logs
- Set the environment variable
QT_LOGGING_RULES=qt*=true
- Start DebugView to capture the debug log messages
- Start mapper.exe
Hopefully something will pop up in the DebugView
Errors reported by the operating system
In the Windows "Event Viewer" application in the "Windows Logs" category usually the "Application" and "System" contain traces that might help pinpoint the failure
Taking mapper.exe startup under the magnifying glass
Using Process Monitor and filtering after
mapper.exe
you can find out all the file access, registry access and so forth.Good luck finding the root cause.
@cristian-adam As I reported earlier, I believed the problem had to do with the code that uses sqlite3_create_function to create a sqlit3 function which means that my cpp file needs to include "sqlite3.h". Furthermore, this file needs to be the same as that used in the particular Qt version.
Here is my code to do this:
void distanceFunc(sqlite3_context* ctx, int argc, sqlite3_value **argv) { double Lat1, Lon1, Lat2, Lon2; Lat1 = sqlite3_value_double(argv[0]); Lon1 = sqlite3_value_double(argv[1]); Lat2 = sqlite3_value_double(argv[2]); Lon2 = sqlite3_value_double(argv[3]); // sqlite3_result_value(distance(LatLng(a1,a2),LatLng(a3,a4))); if (Lat1 == Lat2 && Lon1 == Lon2) sqlite3_result_double(ctx,0); double R = 6371; // RADIUS OF THE EARTH IN KM double dToRad = 0.0174532925; double lat1 = Lat1 * dToRad; //double lon1 = Lon1 * dToRad; double lat2 = Lat2 * dToRad; //double lon2 = Lon2 * dToRad; double dLat = dToRad * (Lat2 - Lat1); double dLon = dToRad * (Lon2 - Lon1); double a = qSin(dLat / 2) * qSin(dLat / 2) + qCos(lat1) * qCos(lat2) * qSin(dLon / 2) * qSin(dLon / 2); double c = 2 * qAtan2(qSqrt(a), qSqrt(1 - a)); double d = R * c; sqlite3_result_double(ctx,d); // distance in kilometers } bool SQL::loadSqlite3Functions(QSqlDatabase db) { QVariant v = db.driver()->handle(); sqlite3 *db_handle = NULL; if (v.isValid() && strcmp(v.typeName(), "sqlite3*") == 0) { // v.data() returns a pointer to the handle db_handle = *static_cast<sqlite3 **>(v.data()); if (!db_handle) { qCritical() <<"Cannot get a sqlite3 handler."; return false; } sqlite3_initialize(); if(sqlite3_create_function(db_handle, "distance", 4, SQLITE_ANY, 0, &distanceFunc, 0, 0)) { qCritical() << "Cannot create SQLite functions: sqlite3_create_function failed."; return false; } return true; } qCritical() << "Cannot get a sqlite3 handle to the driver."; return false; }
code_text
including this file, sqlite3.pri in my .pro file appears to have solved my problem as the compiled program now runs in release mode as well as debug mode!
SOURCES += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.c HEADERS += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h win32:QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote( $$(QTDIR)\\..\\Src\\qtbase\\src\\3rdparty\\sqlite\\sqlite3.h) $$shell_path($$PWD) $$escape_expand(\\n\\t) else:unix:QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote( $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h) $$shell_quote($$PWD) $$escape_expand(\\n\\t) message($$QMAKE_POST_LINK) `` Now, to insure that the MacOS version has no problem with the change.
- Set the environment variable
-