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. link errors with cmake and 6.2.0 static build on windows
Forum Update on Monday, May 27th 2025

link errors with cmake and 6.2.0 static build on windows

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
8 Posts 2 Posters 1.3k 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.
  • C Offline
    C Offline
    ChortleMortal
    wrote on last edited by
    #1

    I am using qtcreator. I have made a static build of 6.2.0 on windows.

    If I use the downloadable DLL release, I can build my project perfectly (both debug and release) using qmake or cmake. This indicates to me stat by CMakeLists.txt file is good.

    Using my static build and qmake, both release and debug builds of my project are fine. This indicates to me that the static build is good.

    If I use cmake, then the release build is good, but the debug build fails. It looks like it is not seeing the debug libraries. I figure it is my problem or everyone would be complaining, but cant figure out why this is. The link errors are numerous, Here is an example:

    Qt6Core.lib(qpluginloader.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in QWindowsVistaStylePlugin_init.cpp.obj
    Qt6Core.lib(qpluginloader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in QWindowsVistaStylePlugin_init.cpp.obj
    Qt6Core.lib(qglobal.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in QWindowsVistaStylePlugin_init.cpp.obj
    Qt6Core.lib(qglobal.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in QWindowsVistaStylePlugin_init.cpp.obj
    

    Does anyone have any ideas on what I need to do to fix this for cmake?

    C 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi,

      From very old memory, it seems that you have your plugins linked against the release VS runtime while the rest is against the debug VS runtime.

      [edit: corrected information SGaist]

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        From very old memory, it seems that you have your plugins linked against the release VS runtime while the rest is against the debug VS runtime.

        [edit: corrected information SGaist]

        C Offline
        C Offline
        ChortleMortal
        wrote on last edited by
        #3

        @SGaist I apologise but don't know what you mean. The reference to plugins just happens to be the first of hundreds of errors. I do not knowingly specify plugins anywhere. The qtcreator build system just seems to handle them under the hood. But since it all builds fine with qmake, why wouldn't it build the same with cmake?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Sorry, I made some errors. Post fixed.

          From the looks of it, it seems that cmake tries to link the release plugins even when using the debug build.

          I would check the cmake files that are handling that in your static installation.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          C 1 Reply Last reply
          0
          • SGaistS SGaist

            Sorry, I made some errors. Post fixed.

            From the looks of it, it seems that cmake tries to link the release plugins even when using the debug build.

            I would check the cmake files that are handling that in your static installation.

            C Offline
            C Offline
            ChortleMortal
            wrote on last edited by
            #5

            @SGaist I agree. It does look like cmake is using release plugins in debug builds. But you say "check the cmake files that are handling this in your static installation". What files would these be? What am I looking for? It is all PFM to me.

            I am wondering if this cmake stuff is really mature enough to be used. qmake still seems a better choice.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              The files in the lib/cmake folder of your static installation.

              There might be glitches. Static builds are not that common as the related requirements to respect the GPL/LGPL licences make the dynamic build more interesting.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              C 1 Reply Last reply
              0
              • SGaistS SGaist

                The files in the lib/cmake folder of your static installation.

                There might be glitches. Static builds are not that common as the related requirements to respect the GPL/LGPL licences make the dynamic build more interesting.

                C Offline
                C Offline
                ChortleMortal
                wrote on last edited by ChortleMortal
                #7

                @SGaist Well there are 944 files in the cmake directory and sub-directories. It is like looking for a needle in a haystack. Unless you can answer specifically what needs to be changed or have any idea why it is not right in the first place, I would respectfully ask you to stop answering and leave the space open for someone who could actually help me with this.

                1 Reply Last reply
                0
                • C ChortleMortal

                  I am using qtcreator. I have made a static build of 6.2.0 on windows.

                  If I use the downloadable DLL release, I can build my project perfectly (both debug and release) using qmake or cmake. This indicates to me stat by CMakeLists.txt file is good.

                  Using my static build and qmake, both release and debug builds of my project are fine. This indicates to me that the static build is good.

                  If I use cmake, then the release build is good, but the debug build fails. It looks like it is not seeing the debug libraries. I figure it is my problem or everyone would be complaining, but cant figure out why this is. The link errors are numerous, Here is an example:

                  Qt6Core.lib(qpluginloader.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in QWindowsVistaStylePlugin_init.cpp.obj
                  Qt6Core.lib(qpluginloader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in QWindowsVistaStylePlugin_init.cpp.obj
                  Qt6Core.lib(qglobal.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in QWindowsVistaStylePlugin_init.cpp.obj
                  Qt6Core.lib(qglobal.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in QWindowsVistaStylePlugin_init.cpp.obj
                  

                  Does anyone have any ideas on what I need to do to fix this for cmake?

                  C Offline
                  C Offline
                  ChortleMortal
                  wrote on last edited by
                  #8

                  @ChortleMortal
                  Well I found out what the problem was. Since 6.2.1 was just released I thought I would make the static libraries for that. I did it exactly the way I did it before, and got exactly the same problem with the debug build. But then I noticed that the instruction at the end of the 'configure' operation had changed from before. Previously it said after the configure and build to run cmake --install . Now it says, run ninja install . I did that, and hey-presto the build works. Still incomprehensible why the new would differ from the old way. But I am moving on, now.

                  Also, if anyone is having the same problem as myself, this is what I used to configure the system:

                  configure -static -debug-and-release -no-pch -confirm-license -prefix "C:\Qt\6.2.1\static" -opensource -mp -nomake examples -nomake tests -no-icu -no-opengl -no-openssl -skip qtwayland -skip qtquick3d -skip qtquickcontrols2 -skip qtquicktimeline -skip qtshadertools -skip qtdeclarative -skip qttools -skip qtdoc -skip qttranslations -skip qt3d -skip qt5compat -skip qtcharts -skip qtcoap -skip qtdatavis3d -skip qtlottie -skip qtmqtt -skip qtopcua -skip qtscxml -skip qtvirtualkeyboard -skip qtmultimedia -skip qtwebengine -skip qtwebview
                  
                  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