Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QT Debugging fails on Windows
Forum Updated to NodeBB v4.3 + New Features

QT Debugging fails on Windows

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
17 Posts 3 Posters 2.2k Views 1 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.
  • A Offline
    A Offline
    allenck
    wrote on last edited by allenck
    #8

    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.

    Allen Kempe

    cristian-adamC 1 Reply Last reply
    0
    • A allenck

      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.

      cristian-adamC Offline
      cristian-adamC Offline
      cristian-adam
      wrote on last edited by
      #9

      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.

      A 1 Reply Last reply
      1
      • cristian-adamC cristian-adam

        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.

        A Offline
        A Offline
        allenck
        wrote on last edited by
        #10

        @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.

        Allen Kempe

        A 1 Reply Last reply
        0
        • A allenck

          @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.

          A Offline
          A Offline
          allenck
          wrote on last edited by
          #11

          @allenck none of these appear to be for Windows:
          816b199c-df6d-4507-96e5-27f2249452eb-image.png

          Allen Kempe

          jsulmJ 1 Reply Last reply
          0
          • A allenck

            @allenck none of these appear to be for Windows:
            816b199c-df6d-4507-96e5-27f2249452eb-image.png

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

            @allenck https://download.qt.io/snapshots/qtcreator/13.0/13.0.0-beta1/42/

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

            cristian-adamC 1 Reply Last reply
            1
            • jsulmJ jsulm

              @allenck https://download.qt.io/snapshots/qtcreator/13.0/13.0.0-beta1/42/

              cristian-adamC Offline
              cristian-adamC Offline
              cristian-adam
              wrote on last edited by
              #13

              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.

              cristian-adamC 1 Reply Last reply
              1
              • cristian-adamC cristian-adam

                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.

                cristian-adamC Offline
                cristian-adamC Offline
                cristian-adam
                wrote on last edited by
                #14

                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 using lldb.exe from Qt Creator 13. See https://bugreports.qt.io/browse/QTCREATORBUG-29423 for more details.

                A 1 Reply Last reply
                0
                • cristian-adamC cristian-adam

                  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 using lldb.exe from Qt Creator 13. See https://bugreports.qt.io/browse/QTCREATORBUG-29423 for more details.

                  A Offline
                  A Offline
                  allenck
                  wrote on last edited by
                  #15

                  @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.

                  Allen Kempe

                  cristian-adamC 1 Reply Last reply
                  0
                  • A allenck

                    @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-adamC Offline
                    cristian-adamC Offline
                    cristian-adam
                    wrote on last edited by
                    #16

                    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

                    1. Set the environment variable QT_LOGGING_RULES=qt*=true
                    2. Start DebugView to capture the debug log messages
                    3. 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.

                    A 1 Reply Last reply
                    1
                    • cristian-adamC cristian-adam

                      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

                      1. Set the environment variable QT_LOGGING_RULES=qt*=true
                      2. Start DebugView to capture the debug log messages
                      3. 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.

                      A Offline
                      A Offline
                      allenck
                      wrote on last edited by
                      #17

                      @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.

                      Allen Kempe

                      1 Reply Last reply
                      2
                      • A allenck has marked this topic as solved on

                      • Login

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