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. Qt 6.3.1 painful....
Forum Updated to NodeBB v4.3 + New Features

Qt 6.3.1 painful....

Scheduled Pinned Locked Moved Unsolved General and Desktop
31 Posts 5 Posters 3.9k Views 2 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.
  • Christian EhrlicherC Online
    Christian EhrlicherC Online
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by Christian Ehrlicher
    #2

    Don't go from 5.12 to 6.x but from 5.12 to 5.15, remove all the deprecation warnings and then go to 6.x.
    QRegExp is deprecated since ages (a.k.a since Qt5.0)...

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    SPlattenS 1 Reply Last reply
    1
    • Christian EhrlicherC Christian Ehrlicher

      Don't go from 5.12 to 6.x but from 5.12 to 5.15, remove all the deprecation warnings and then go to 6.x.
      QRegExp is deprecated since ages (a.k.a since Qt5.0)...

      SPlattenS Offline
      SPlattenS Offline
      SPlatten
      wrote on last edited by
      #3

      @Christian-Ehrlicher , I don’t think I have a choice, because the target is an Apple M1.

      Kind Regards,
      Sy

      D Christian EhrlicherC 2 Replies Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #4

        Then go with the latest Qt6. Too many changes in Qt6. Personally, I would wait a few more months to touch Qt6.

        SPlattenS 1 Reply Last reply
        0
        • JoeCFDJ JoeCFD

          Then go with the latest Qt6. Too many changes in Qt6. Personally, I would wait a few more months to touch Qt6.

          SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #5

          @JoeCFD I don’t really have the option to wait.

          Kind regards
          Simon

          Kind Regards,
          Sy

          1 Reply Last reply
          0
          • SPlattenS SPlatten

            @Christian-Ehrlicher , I don’t think I have a choice, because the target is an Apple M1.

            D Offline
            D Offline
            DerReisende
            wrote on last edited by
            #6

            @SPlatten you could use a virtual machine with linux and do the latest qt5 deprecation removal there. Than either move back to mac and finish the qt6 port or continue on linux until you have a running version. That should be the quickest and most painless approach IMHO.

            SPlattenS 1 Reply Last reply
            1
            • D DerReisende

              @SPlatten you could use a virtual machine with linux and do the latest qt5 deprecation removal there. Than either move back to mac and finish the qt6 port or continue on linux until you have a running version. That should be the quickest and most painless approach IMHO.

              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #7

              @DerReisende , thank you, its not a race to get it finished, I just want to get the Qt 6.3.1 version building on the MacBook Pro.

              Kind Regards,
              Sy

              SPlattenS 1 Reply Last reply
              0
              • SPlattenS SPlatten

                @DerReisende , thank you, its not a race to get it finished, I just want to get the Qt 6.3.1 version building on the MacBook Pro.

                SPlattenS Offline
                SPlattenS Offline
                SPlatten
                wrote on last edited by
                #8

                @DerReisende , @JoeCFD , it seems Qt6 is a lot more strict on its requirements, I've fixed all the compile warnings now looking at the run-time issues that are new in this release.

                Kind Regards,
                Sy

                1 Reply Last reply
                0
                • SPlattenS SPlatten

                  @Christian-Ehrlicher , I don’t think I have a choice, because the target is an Apple M1.

                  Christian EhrlicherC Online
                  Christian EhrlicherC Online
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  @SPlatten said in Qt 6.3.1 painful....:

                  because the target is an Apple M1.

                  So you want to tell me you can compile your program with Qt5.12 but not with Qt5.15? Nice try...

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  SPlattenS 1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    @SPlatten said in Qt 6.3.1 painful....:

                    because the target is an Apple M1.

                    So you want to tell me you can compile your program with Qt5.12 but not with Qt5.15? Nice try...

                    SPlattenS Offline
                    SPlattenS Offline
                    SPlatten
                    wrote on last edited by
                    #10

                    @Christian-Ehrlicher , if I was working on my iMAC its not a problem as that's an i7, as I said I am now working on my MacBook Pro M1.

                    Kind Regards,
                    Sy

                    1 Reply Last reply
                    0
                    • SPlattenS Offline
                      SPlattenS Offline
                      SPlatten
                      wrote on last edited by SPlatten
                      #11

                      Still trying to fix this, in my pro file I have:

                      #-------------------------------------------------
                      #
                      # Project created by QtCreator 2018-10-15T09:17:31
                      #
                      #-------------------------------------------------
                      
                      QT += core network gui qml sql
                      greaterThan(QT_MAJOR_VERSION, 4): QT += svg widgets
                      greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat statemachine svgwidgets
                      TARGET = XMLMPAM
                      TEMPLATE = app
                      # Uncomment to include XML debug information
                      #DEFINES += DEBUG_JSON
                      DEFINES += DEBUG_LAUNCHER
                      DEFINES += DEBUG_MODULES
                      #DEFINES += DEBUG_SOCKETS
                      DEFINES += DEBUG_SCRIPT
                      DEFINES += DEBUG_SIGNALS
                      #DEFINES += DEBUG_THREADS
                      #DEFINES += DEBUG_XML
                      ####### Custom Variables
                      EXPORT_QMAKE_MAC_SDK = macosx
                      EXPORT_QMAKE_MAC_SDK_VERSION = 10.15
                      EXPORT_VALID_ARCHS = x86_64
                      # The following define makes your compiler emit warnings if you use
                      # any feature of Qt which has been marked as deprecated (the exact warnings
                      # depend on your compiler). Please consult the documentation of the
                      # deprecated API in order to know how to port your code away from it.
                      DEFINES += QT_DEPRECATED_WARNINGS
                      # Added when porting to Qt 6
                      DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
                      # You can also make your code fail to compile if you use deprecated APIs.
                      # In order to do so, uncomment the following line.
                      # You can also select to disable deprecated APIs only up to a certain version of Qt.
                      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                      CONFIG += c++11
                      CONFIG += console
                      CONFIG += sdk_no_version_check
                      CONFIG += app_bundle
                      CONFIG += QT_DEBUG_PLUGINS
                      #CONFIG += qml_debug
                      
                      SOURCES += \
                              clsCNT.cpp \
                              clsDebugService.cpp \
                              clsFileThread.cpp \
                              clsJSON.cpp \
                              clsListener.cpp \
                              clsMainWnd.cpp \
                              clsModule.cpp \
                              clsQtCheckBox.cpp \
                              clsQtComboBox.cpp \
                              clsQtFrame.cpp \
                              clsQtJsonStack.cpp \
                              clsQtLabel.cpp \
                              clsQtLayout.cpp \
                              clsQtLineEdit.cpp \
                              clsQtListWidget.cpp \
                              clsQtPushBtn.cpp \
                              clsQtRadioButton.cpp \
                              clsQtSlider.cpp \
                              clsQtTextEdit.cpp \
                              clsSignal.cpp \
                              clsScriptHelper.cpp \
                              clsThread.cpp \
                              XMLMPAM.cpp
                      
                      HEADERS += \
                              clsCNT.h \
                              clsDebugService.h \
                              clsJSON.h \
                              clsListener.h \
                              clsMainWnd.h \
                              clsFileThread.h \
                              clsModule.h \
                              clsQtCheckBox.h \
                              clsQtComboBox.h \
                              clsQtFrame.h \
                              clsQtJsonStack.h \
                              clsQtLabel.h \
                              clsQtLayout.h \
                              clsQtLineEdit.h \
                              clsQtListWidget.h \
                              clsQtPushBtn.h \
                              clsQtRadioButton.h \
                              clsQtSlider.h \
                              clsQtTextEdit.h \
                              clsScriptHelper.h \
                              clsSignal.h \
                              clsThread.h
                      
                      FORMS += \
                              clsMainWnd.ui
                      
                      # Default rules for deployment.
                      qnx: target.path = /tmp/$${TARGET}/bin
                      else: unix:!android: target.path = /opt/$${TARGET}/bin
                      !isEmpty(target.path): INSTALLS += target
                      
                      RESOURCES += \
                          clsmainwnd.qrc
                      
                      DISTFILES += \
                          config/form.xml \
                          config/form2.xml \
                          config/simon.js \
                          config/simon.xml \
                          config/simon2.js \
                          config/xmlmpam.xml
                      

                      Just spotted:

                      EXPORT_QMAKE_MAC_SDK = macosx
                      EXPORT_QMAKE_MAC_SDK_VERSION = 10.15
                      EXPORT_VALID_ARCHS = x86_64
                      

                      Could these be a problem on the MacBook Pro M1 ?

                      Have modified pro file for apple M1 build:

                      EXPORT_VALID_ARCHS = arm64
                      

                      Building now...how can I add a conditional argument to build for either x86_64 on iMAC or arm64 on macBook Pro M1 ?

                      Kind Regards,
                      Sy

                      SPlattenS 1 Reply Last reply
                      0
                      • SPlattenS SPlatten

                        Still trying to fix this, in my pro file I have:

                        #-------------------------------------------------
                        #
                        # Project created by QtCreator 2018-10-15T09:17:31
                        #
                        #-------------------------------------------------
                        
                        QT += core network gui qml sql
                        greaterThan(QT_MAJOR_VERSION, 4): QT += svg widgets
                        greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat statemachine svgwidgets
                        TARGET = XMLMPAM
                        TEMPLATE = app
                        # Uncomment to include XML debug information
                        #DEFINES += DEBUG_JSON
                        DEFINES += DEBUG_LAUNCHER
                        DEFINES += DEBUG_MODULES
                        #DEFINES += DEBUG_SOCKETS
                        DEFINES += DEBUG_SCRIPT
                        DEFINES += DEBUG_SIGNALS
                        #DEFINES += DEBUG_THREADS
                        #DEFINES += DEBUG_XML
                        ####### Custom Variables
                        EXPORT_QMAKE_MAC_SDK = macosx
                        EXPORT_QMAKE_MAC_SDK_VERSION = 10.15
                        EXPORT_VALID_ARCHS = x86_64
                        # The following define makes your compiler emit warnings if you use
                        # any feature of Qt which has been marked as deprecated (the exact warnings
                        # depend on your compiler). Please consult the documentation of the
                        # deprecated API in order to know how to port your code away from it.
                        DEFINES += QT_DEPRECATED_WARNINGS
                        # Added when porting to Qt 6
                        DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
                        # You can also make your code fail to compile if you use deprecated APIs.
                        # In order to do so, uncomment the following line.
                        # You can also select to disable deprecated APIs only up to a certain version of Qt.
                        #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                        CONFIG += c++11
                        CONFIG += console
                        CONFIG += sdk_no_version_check
                        CONFIG += app_bundle
                        CONFIG += QT_DEBUG_PLUGINS
                        #CONFIG += qml_debug
                        
                        SOURCES += \
                                clsCNT.cpp \
                                clsDebugService.cpp \
                                clsFileThread.cpp \
                                clsJSON.cpp \
                                clsListener.cpp \
                                clsMainWnd.cpp \
                                clsModule.cpp \
                                clsQtCheckBox.cpp \
                                clsQtComboBox.cpp \
                                clsQtFrame.cpp \
                                clsQtJsonStack.cpp \
                                clsQtLabel.cpp \
                                clsQtLayout.cpp \
                                clsQtLineEdit.cpp \
                                clsQtListWidget.cpp \
                                clsQtPushBtn.cpp \
                                clsQtRadioButton.cpp \
                                clsQtSlider.cpp \
                                clsQtTextEdit.cpp \
                                clsSignal.cpp \
                                clsScriptHelper.cpp \
                                clsThread.cpp \
                                XMLMPAM.cpp
                        
                        HEADERS += \
                                clsCNT.h \
                                clsDebugService.h \
                                clsJSON.h \
                                clsListener.h \
                                clsMainWnd.h \
                                clsFileThread.h \
                                clsModule.h \
                                clsQtCheckBox.h \
                                clsQtComboBox.h \
                                clsQtFrame.h \
                                clsQtJsonStack.h \
                                clsQtLabel.h \
                                clsQtLayout.h \
                                clsQtLineEdit.h \
                                clsQtListWidget.h \
                                clsQtPushBtn.h \
                                clsQtRadioButton.h \
                                clsQtSlider.h \
                                clsQtTextEdit.h \
                                clsScriptHelper.h \
                                clsSignal.h \
                                clsThread.h
                        
                        FORMS += \
                                clsMainWnd.ui
                        
                        # Default rules for deployment.
                        qnx: target.path = /tmp/$${TARGET}/bin
                        else: unix:!android: target.path = /opt/$${TARGET}/bin
                        !isEmpty(target.path): INSTALLS += target
                        
                        RESOURCES += \
                            clsmainwnd.qrc
                        
                        DISTFILES += \
                            config/form.xml \
                            config/form2.xml \
                            config/simon.js \
                            config/simon.xml \
                            config/simon2.js \
                            config/xmlmpam.xml
                        

                        Just spotted:

                        EXPORT_QMAKE_MAC_SDK = macosx
                        EXPORT_QMAKE_MAC_SDK_VERSION = 10.15
                        EXPORT_VALID_ARCHS = x86_64
                        

                        Could these be a problem on the MacBook Pro M1 ?

                        Have modified pro file for apple M1 build:

                        EXPORT_VALID_ARCHS = arm64
                        

                        Building now...how can I add a conditional argument to build for either x86_64 on iMAC or arm64 on macBook Pro M1 ?

                        SPlattenS Offline
                        SPlattenS Offline
                        SPlatten
                        wrote on last edited by SPlatten
                        #12

                        @SPlatten , I'm struggling to understand by the application crashes on start-up when run on the MacBook Pro m1, it doesn't on the iMAC.

                        Its very difficult to debug because it halts in qarraydata on line 178 but the debug locals area only contains:

                        [statics]
                            None
                        allocSize.   <not accessible>
                        header.       0x0
                        

                        Can anyone suggest how I might fault find this problem?

                        There is a problem report but its two large to post.

                        Kind Regards,
                        Sy

                        D 1 Reply Last reply
                        0
                        • SPlattenS SPlatten

                          @SPlatten , I'm struggling to understand by the application crashes on start-up when run on the MacBook Pro m1, it doesn't on the iMAC.

                          Its very difficult to debug because it halts in qarraydata on line 178 but the debug locals area only contains:

                          [statics]
                              None
                          allocSize.   <not accessible>
                          header.       0x0
                          

                          Can anyone suggest how I might fault find this problem?

                          There is a problem report but its two large to post.

                          D Offline
                          D Offline
                          DerReisende
                          wrote on last edited by
                          #13

                          @SPlatten In another thread here I mentioned architectural differences of Apple Silicon to intel which may cause working intel code to crash when compiled for Apple Silicon. Apple suggests in this video to use thread sanitizer etc to hunt for those bugs in your code. If your x86 app runs without problems using Rosetta but crashes when compiled as apple native then you may have one of the problems described in the video. It might worth a shot compiling and running your app with various sanitizer options.

                          SPlattenS 1 Reply Last reply
                          0
                          • D DerReisende

                            @SPlatten In another thread here I mentioned architectural differences of Apple Silicon to intel which may cause working intel code to crash when compiled for Apple Silicon. Apple suggests in this video to use thread sanitizer etc to hunt for those bugs in your code. If your x86 app runs without problems using Rosetta but crashes when compiled as apple native then you may have one of the problems described in the video. It might worth a shot compiling and running your app with various sanitizer options.

                            SPlattenS Offline
                            SPlattenS Offline
                            SPlatten
                            wrote on last edited by
                            #14

                            @DerReisende , thank you, I will go take a look.

                            Kind Regards,
                            Sy

                            D 1 Reply Last reply
                            0
                            • SPlattenS SPlatten

                              @DerReisende , thank you, I will go take a look.

                              D Offline
                              D Offline
                              DerReisende
                              wrote on last edited by
                              #15

                              @SPlatten And for Apple SIlicon builds the minimum sdk should be 11.0. That was the one when it got introduced and Apple uses -target arm64-apple-macos11 in their samples here.

                              SPlattenS 1 Reply Last reply
                              0
                              • D DerReisende

                                @SPlatten And for Apple SIlicon builds the minimum sdk should be 11.0. That was the one when it got introduced and Apple uses -target arm64-apple-macos11 in their samples here.

                                SPlattenS Offline
                                SPlattenS Offline
                                SPlatten
                                wrote on last edited by SPlatten
                                #16

                                @DerReisende , how or where do I get the version to assign to EXPORT_QMAKE_MAC_SDK_VERSION ?
                                [Edit] Is this the version displayed when running Xcode ? In my case 13.4.1
                                [Edit2] My project still crashes in qarraydata on line 178, `I'm wondering if there is an issue with the type long long as Qt Creator does not show the value associated with allocSize which is of type long long ?

                                Kind Regards,
                                Sy

                                D 1 Reply Last reply
                                0
                                • SPlattenS SPlatten

                                  @DerReisende , how or where do I get the version to assign to EXPORT_QMAKE_MAC_SDK_VERSION ?
                                  [Edit] Is this the version displayed when running Xcode ? In my case 13.4.1
                                  [Edit2] My project still crashes in qarraydata on line 178, `I'm wondering if there is an issue with the type long long as Qt Creator does not show the value associated with allocSize which is of type long long ?

                                  D Offline
                                  D Offline
                                  DerReisende
                                  wrote on last edited by
                                  #17

                                  @SPlatten I am not sure if QMAKE_MAC_SDK_VERSION is the correct way to set the macos minimum sdk version during compilation. But I have to admit that I dont use qmake. A quick search gave me this thread which may be more correct to specify the target sdk for compilation.

                                  Did you compile and run the project with -fsanitize=thread compiler option`?

                                  SPlattenS 1 Reply Last reply
                                  0
                                  • D DerReisende

                                    @SPlatten I am not sure if QMAKE_MAC_SDK_VERSION is the correct way to set the macos minimum sdk version during compilation. But I have to admit that I dont use qmake. A quick search gave me this thread which may be more correct to specify the target sdk for compilation.

                                    Did you compile and run the project with -fsanitize=thread compiler option`?

                                    SPlattenS Offline
                                    SPlattenS Offline
                                    SPlatten
                                    wrote on last edited by
                                    #18

                                    @DerReisende Thank you, I want to keep using the .pro file if possible so I will look for a MIN version of the directive.

                                    Kind Regards,
                                    Sy

                                    1 Reply Last reply
                                    0
                                    • SPlattenS Offline
                                      SPlattenS Offline
                                      SPlatten
                                      wrote on last edited by SPlatten
                                      #19

                                      I'm not sure I am winning this battle Qt 6.3.1 on my MacBook Pro Apple M1 is not going anywhere fast.

                                      My application is multi-threaded, when I run the application it is halting in (__pthread_kill) showing a window containing nothing but hex, the stack trade showing in Test Results panel contains:

                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                          
                                      1  __pthread_kill                                                                                                               (arm64e) /usr/lib/system/libsystem_kernel.dylib                                         0x185b2ed98 
                                      2  pthread_kill                                                                                                                 (arm64e) /usr/lib/system/libsystem_pthread.dylib                                        0x185b63ee0 
                                      3  abort                                                                                                                        (arm64e) /usr/lib/system/libsystem_c.dylib                                              0x185a9e340 
                                      4  malloc_vreport                                                                                                               (arm64e) /usr/lib/system/libsystem_malloc.dylib                                         0x1859808c0 
                                      5  malloc_zone_error                                                                                                            (arm64e) /usr/lib/system/libsystem_malloc.dylib                                         0x185995c84 
                                      6  nanov2_allocate_from_block                                                                                                   (arm64e) /usr/lib/system/libsystem_malloc.dylib                                         0x185972bc4 
                                      7  nanov2_allocate                                                                                                              (arm64e) /usr/lib/system/libsystem_malloc.dylib                                         0x1859721e0 
                                      8  nanov2_calloc                                                                                                                (arm64e) /usr/lib/system/libsystem_malloc.dylib                                         0x18597437c 
                                      9  _malloc_zone_calloc                                                                                                          (arm64e) /usr/lib/system/libsystem_malloc.dylib                                         0x18598f840 
                                      10 class_createInstance                                                                                                         (arm64e) /usr/lib/libobjc.A.dylib                                                       0x1859ea404 
                                      11 _os_object_alloc_realized                                                                                                    (arm64e) /usr/lib/system/libdispatch.dylib                                              0x18599f568 
                                      12 _xpc_dictionary_deserialize                                                                                                  (arm64e) /usr/lib/system/libxpc.dylib                                                   0x1858982d0 
                                      13 _xpc_array_deserialize                                                                                                       (arm64e) /usr/lib/system/libxpc.dylib                                                   0x1858981ec 
                                      14 _xpc_dictionary_unpack_value                                                                                                 (arm64e) /usr/lib/system/libxpc.dylib                                                   0x185893fc0 
                                      15 _xpc_dictionary_unpack_value_and_vend                                                                                        (arm64e) /usr/lib/system/libxpc.dylib                                                   0x185895424 
                                      16 _xpc_dictionary_look_up                                                                                                      (arm64e) /usr/lib/system/libxpc.dylib                                                   0x18588fe8c 
                                      17 -[CFPrefsSearchListSource handleReply:toRequestNewDataMessage:onConnection:retryCount:error:]                                (arm64e) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation  0x185be46a4 
                                      18 __80-[CFPrefsSearchListSource alreadylocked_generationCountFromListOfSources:count:]_block_invoke                            (arm64e) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation  0x185be45a8 
                                      19 __104-[CFPrefsSearchListSource synchronouslySendDaemonMessage:andAgentMessage:andDirectMessage:replyHandler:]_block_invoke_2 (arm64e) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation  0x185be4540 
                                      20 -[_CFXPreferences withConnectionForRole:performBlock:]                                                                       (arm64e) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation  0x185be4100 
                                      21 __104-[CFPrefsSearchListSource synchronouslySendDaemonMessage:andAgentMessage:andDirectMessage:replyHandler:]_block_invoke   (arm64e) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation  0x185be40a4 
                                      22 _dispatch_client_callout2                                                                                                    (arm64e) /usr/lib/system/libdispatch.dylib                                              0x1859a01f4 
                                      23 _dispatch_apply_invoke                                                                                                       (arm64e) /usr/lib/system/libdispatch.dylib                                              0x1859b3954 
                                      24 _dispatch_client_callout                                                                                                     (arm64e) /usr/lib/system/libdispatch.dylib                                              0x1859a01b4 
                                      25 _dispatch_root_queue_drain                                                                                                   (arm64e) /usr/lib/system/libdispatch.dylib                                              0x1859b1a04 
                                      26 _dispatch_worker_thread2                                                                                                     (arm64e) /usr/lib/system/libdispatch.dylib                                              0x1859b2104 
                                      27 _pthread_wqthread                                                                                                            (arm64e) /usr/lib/system/libsystem_pthread.dylib                                        0x185b60324 
                                      
                                      

                                      Kind Regards,
                                      Sy

                                      1 Reply Last reply
                                      0
                                      • JoeCFDJ Offline
                                        JoeCFDJ Offline
                                        JoeCFD
                                        wrote on last edited by
                                        #20

                                        I guess you are able to use c++20 now. Adding logging code into your threads may enable you to find issues more quickly.
                                        https://mariusbancila.ro/blog/2021/07/03/writing-a-simple-logging-function-in-c20/

                                        D 1 Reply Last reply
                                        0
                                        • JoeCFDJ JoeCFD

                                          I guess you are able to use c++20 now. Adding logging code into your threads may enable you to find issues more quickly.
                                          https://mariusbancila.ro/blog/2021/07/03/writing-a-simple-logging-function-in-c20/

                                          D Offline
                                          D Offline
                                          DerReisende
                                          wrote on last edited by
                                          #21

                                          @JoeCFD You don't need c++20 to do that, QMessageLogContext does give you the same information if you install a proper message handler:

                                          static void qt_message_handler(QtMsgType type, [[maybe_unused]] const QMessageLogContext &context, const QString &msg) {
                                              const QByteArray localMsg = msg.toLocal8Bit();
                                          #ifdef NDEBUG
                                              const auto out_msg = fmt::format("\t{}", localMsg.constData());
                                          #else
                                              const char *function = context.function ? context.function : "";
                                              const auto out_msg = fmt::format("\t{} [LINE:{}, {}]",
                                                                                localMsg.constData(),
                                                                                context.line,
                                                                                function);
                                          #endif
                                              switch (type) {
                                                  case QtDebugMsg:
                                                      spdlog::debug(out_msg);
                                                      break;
                                                  case QtInfoMsg:
                                                      spdlog::info(out_msg);
                                                      break;
                                                  case QtWarningMsg:
                                                      spdlog::warn(out_msg);
                                                      break;
                                                  case QtCriticalMsg:
                                                      spdlog::error(out_msg);
                                                      break;
                                                  case QtFatalMsg:
                                                      spdlog::critical(out_msg);
                                                      spdlog::shutdown();
                                                      break;
                                              }
                                          }
                                          
                                          void init_logging() {
                                              init_spdlog();
                                          
                                              qInstallMessageHandler(qt_message_handler);
                                          } 
                                          

                                          I am using spdlog and fmt::format for logging and formatting but in the end you will get almost the same details for all Qt logging calls as with your example.

                                          SPlattenS JoeCFDJ 2 Replies 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