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. Getting SIGSEGV when using external lib after upgrade to Qt 6.4
Forum Updated to NodeBB v4.3 + New Features

Getting SIGSEGV when using external lib after upgrade to Qt 6.4

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 396 Views
  • 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.
  • O Offline
    O Offline
    odriscog
    wrote on last edited by
    #1

    Hi there everyone,

    I am currently upgrading my application from Qt 5.15.2 to 6.4.2. The application uses an external library c_static.lib made by Kx from here. After the upgrade to 6.4.2, the application builds without any issues. However, when I run it, it crashes at the very first line where we use a function from c_static.lib. It crashes with a SIGSEGV error. I don't have any visibility into the source of the lib and have asked about it in the Kx forum here but had no replies. I'm still unsure if the issue is with the lib or Qt but, given that the lib works fine in Qt 5.15.2, I was hoping someone may be able to help here.

    This is the configuration we currently use (and the lib works fine)
    60e5a92b-02ad-4d55-bac7-046af9a6ead5-image.png

    And this is the configuration I want to upgrade to (crashes with SIGSEGV when I use the lib)
    dae3a505-218b-4a22-b3ac-324f460ca77e-image.png

    Thank you in advance for your help!

    jsulmJ 1 Reply Last reply
    0
    • O odriscog

      Hi there everyone,

      I am currently upgrading my application from Qt 5.15.2 to 6.4.2. The application uses an external library c_static.lib made by Kx from here. After the upgrade to 6.4.2, the application builds without any issues. However, when I run it, it crashes at the very first line where we use a function from c_static.lib. It crashes with a SIGSEGV error. I don't have any visibility into the source of the lib and have asked about it in the Kx forum here but had no replies. I'm still unsure if the issue is with the lib or Qt but, given that the lib works fine in Qt 5.15.2, I was hoping someone may be able to help here.

      This is the configuration we currently use (and the lib works fine)
      60e5a92b-02ad-4d55-bac7-046af9a6ead5-image.png

      And this is the configuration I want to upgrade to (crashes with SIGSEGV when I use the lib)
      dae3a505-218b-4a22-b3ac-324f460ca77e-image.png

      Thank you in advance for your help!

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

      @odriscog said in Getting SIGSEGV when using external lib after upgrade to Qt 6.4:

      SIGSEGV

      Could be invalid pointer. Please show your code where this happens.

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

      O 1 Reply Last reply
      0
      • jsulmJ jsulm

        @odriscog said in Getting SIGSEGV when using external lib after upgrade to Qt 6.4:

        SIGSEGV

        Could be invalid pointer. Please show your code where this happens.

        O Offline
        O Offline
        odriscog
        wrote on last edited by
        #3

        @jsulm

        Hi there,

        Thank you for your reply. The crash happens in my code when I use the method

        ktn(KS, 0)
        

        which is declared in the k.h file here. I think the definition is in the c_static lib here. I've asked the Kx community about the issue but had no replies and just wanted to ask here in case anyone could help.

        Thank you

        O 1 Reply Last reply
        0
        • O odriscog

          @jsulm

          Hi there,

          Thank you for your reply. The crash happens in my code when I use the method

          ktn(KS, 0)
          

          which is declared in the k.h file here. I think the definition is in the c_static lib here. I've asked the Kx community about the issue but had no replies and just wanted to ask here in case anyone could help.

          Thank you

          O Offline
          O Offline
          odriscog
          wrote on last edited by
          #4

          @jsulm

          When I created a new project to test just this library in isolation, I get the same issue.

          testk.pro

          QT       += core gui
          
          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
          
          CONFIG += c++17
          QMAKE_CXXFLAGS += -DKXVER=3 -std=c++17 -O3 -Wno-missing-field-initializers
          QMAKE_CXXFLAGS_RELEASE -= -O3
          WIN_KX_INSTALL = $$(USERPROFILE)/code/kx
          
          win32: INCLUDEPATH += $${WIN_KX_INSTALL}/h/
          win32: HEADERS += $${WIN_KX_INSTALL}/h/k.h
          win32: LIBS += -L$${WIN_KX_INSTALL}/lib/ -lc_static -lws2_32 -liphlpapi
          
          SOURCES += \
              main.cpp
          

          main.cpp

          #include "k.h"
          
          int main(int argc, char *argv[])
          {
              K test = ktn(KS, 0);
          }
          

          When I build and run this using Qt 5.15.2, it works fine but it crashes with SIGSEGV when I build and run using Qt 6.4.2 (as per the kit configurations shown in my original post)

          Thank you!

          Christian EhrlicherC 1 Reply Last reply
          0
          • O odriscog

            @jsulm

            When I created a new project to test just this library in isolation, I get the same issue.

            testk.pro

            QT       += core gui
            
            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
            
            CONFIG += c++17
            QMAKE_CXXFLAGS += -DKXVER=3 -std=c++17 -O3 -Wno-missing-field-initializers
            QMAKE_CXXFLAGS_RELEASE -= -O3
            WIN_KX_INSTALL = $$(USERPROFILE)/code/kx
            
            win32: INCLUDEPATH += $${WIN_KX_INSTALL}/h/
            win32: HEADERS += $${WIN_KX_INSTALL}/h/k.h
            win32: LIBS += -L$${WIN_KX_INSTALL}/lib/ -lc_static -lws2_32 -liphlpapi
            
            SOURCES += \
                main.cpp
            

            main.cpp

            #include "k.h"
            
            int main(int argc, char *argv[])
            {
                K test = ktn(KS, 0);
            }
            

            When I build and run this using Qt 5.15.2, it works fine but it crashes with SIGSEGV when I build and run using Qt 6.4.2 (as per the kit configurations shown in my original post)

            Thank you!

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Are you sure the provided precompiled library is compatible with MinGW? Looks like it's a MSVC library sind it's file prefix is .lib and not .a. Or is it a plain c library? But even then there might by differences e.g. due to c++17 compiler flag or others.

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

            O 1 Reply Last reply
            1
            • Christian EhrlicherC Christian Ehrlicher

              Are you sure the provided precompiled library is compatible with MinGW? Looks like it's a MSVC library sind it's file prefix is .lib and not .a. Or is it a plain c library? But even then there might by differences e.g. due to c++17 compiler flag or others.

              O Offline
              O Offline
              odriscog
              wrote on last edited by
              #6

              @Christian-Ehrlicher

              Hi there Christian,

              This is a really helpful suggestion for me to look into thank you. We have always used MinGW for our project as we need to compile for both Windows and Linux and I was told MinGW would make this easier thank MSVC. I am happy to be corrected if that is not the case!

              The full set of Linux, MacOS and Windows libs which are provided by Kx can be found here. I don't see any .a libraries there, just .lib. Does that mean we should strictly be using MSVC with these libs?

              Another update on the issue I am having:
              I wondered whether the different MinGW version might be the cause of the crashes I was seeing. The Qt wiki outlines the version of MinGW used included in each version here. I tried to build our project in Qt 6.2.1 as it uses the same MinGW version as Qt 5.15.2 (which runs our project just fine). The project builds and runs perfectly on Qt 6.2.1 but fails on any later version. So I'm tempted to conclude the new MinGW versions are not compatible with the Kx libraries but I am at a loss to explain why.

              Thank you as ever!

              JonBJ 1 Reply Last reply
              0
              • O odriscog

                @Christian-Ehrlicher

                Hi there Christian,

                This is a really helpful suggestion for me to look into thank you. We have always used MinGW for our project as we need to compile for both Windows and Linux and I was told MinGW would make this easier thank MSVC. I am happy to be corrected if that is not the case!

                The full set of Linux, MacOS and Windows libs which are provided by Kx can be found here. I don't see any .a libraries there, just .lib. Does that mean we should strictly be using MSVC with these libs?

                Another update on the issue I am having:
                I wondered whether the different MinGW version might be the cause of the crashes I was seeing. The Qt wiki outlines the version of MinGW used included in each version here. I tried to build our project in Qt 6.2.1 as it uses the same MinGW version as Qt 5.15.2 (which runs our project just fine). The project builds and runs perfectly on Qt 6.2.1 but fails on any later version. So I'm tempted to conclude the new MinGW versions are not compatible with the Kx libraries but I am at a loss to explain why.

                Thank you as ever!

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @odriscog said in Getting SIGSEGV when using external lib after upgrade to Qt 6.4:

                just .lib. Does that mean we should strictly be using MSVC with these libs?

                Yep, that is the implication. .lib is the MSVC++ library file extension, .a is the MinGW one (unless a C-only library, not C++). You cannot mix MSVC & MinGW compiled elements. Having said that, I am surprised that anything ever linked if this was the case.

                1 Reply 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