Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. "Mismatch detected for RuntimeLibrary" when trying to statically compile with a static build of Qt
Forum Updated to NodeBB v4.3 + New Features

"Mismatch detected for RuntimeLibrary" when trying to statically compile with a static build of Qt

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
static buildmsvc2017
3 Posts 3 Posters 1.8k 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.
  • E Offline
    E Offline
    EinderJam
    wrote on 11 Jul 2018, 12:11 last edited by
    #1

    Hello everybody, this is my first post on Qt forum. I'm trying to compile and use a static build of Qt 5.11 compiled with MSVC on windows 10.
    What I did so far (using VS 2017 x64 native tools command prompt) :

    configure -static -release -platform win32-msvc -prefix F:\qt-everywhere-src-5.11.1\static_build -nomake examples -nomake tests
    nmake
    nmake install
    

    Before building, using this tutorial, I modified qt-everywhere-src-5.11.1\qtbase\mkspecs\msvc-desktop.conf and replaced every -MD by -MT

    Build process went fine. After that, I installed QtCreator 4.3.1 and set up a Qt kit using MSVC compiler and my newly built Qt version.
    I created a new default Qt project (with mainwindow.cpp and mainwindow.h). It compiled successfully with -MD flag (this is strange), but when I added :

    QMAKE_CXXFLAGS_RELEASE = -MT
    CONFIG += static
    

    to my .pro file, I get hundred of errors like this (this time compiler is using /MT flag) :

    qwindowsvistastyle.lib(main.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MT_StaticRelease' in main.obj
    

    and this for every Qt lib.
    So I'm wondering : I specified -static in configure step, I have all Qt libs in my static_build folder, but :

    • Qt projects compiles with /MD, not with /MT
    • I can't use other static libraries, because I have to use /MT, which is impossible because of Qt at this time.
      What is my mistake ?
      Thanks in advance,
      EinderJam
    J 1 Reply Last reply 11 Jul 2018, 12:45
    0
    • E EinderJam
      11 Jul 2018, 12:11

      Hello everybody, this is my first post on Qt forum. I'm trying to compile and use a static build of Qt 5.11 compiled with MSVC on windows 10.
      What I did so far (using VS 2017 x64 native tools command prompt) :

      configure -static -release -platform win32-msvc -prefix F:\qt-everywhere-src-5.11.1\static_build -nomake examples -nomake tests
      nmake
      nmake install
      

      Before building, using this tutorial, I modified qt-everywhere-src-5.11.1\qtbase\mkspecs\msvc-desktop.conf and replaced every -MD by -MT

      Build process went fine. After that, I installed QtCreator 4.3.1 and set up a Qt kit using MSVC compiler and my newly built Qt version.
      I created a new default Qt project (with mainwindow.cpp and mainwindow.h). It compiled successfully with -MD flag (this is strange), but when I added :

      QMAKE_CXXFLAGS_RELEASE = -MT
      CONFIG += static
      

      to my .pro file, I get hundred of errors like this (this time compiler is using /MT flag) :

      qwindowsvistastyle.lib(main.obj) : error LNK2038: discordance détectée pour 'RuntimeLibrary' : la valeur 'MD_DynamicRelease' ne correspond pas à la valeur 'MT_StaticRelease' in main.obj
      

      and this for every Qt lib.
      So I'm wondering : I specified -static in configure step, I have all Qt libs in my static_build folder, but :

      • Qt projects compiles with /MD, not with /MT
      • I can't use other static libraries, because I have to use /MT, which is impossible because of Qt at this time.
        What is my mistake ?
        Thanks in advance,
        EinderJam
      J Offline
      J Offline
      JonB
      wrote on 11 Jul 2018, 12:45 last edited by
      #2

      @EinderJam said in "Mismatch detected for RuntimeLibrary" when trying to statically compile with a static build of Qt:

      Before building, using this tutorial, I modified qt-everywhere-src-5.11.1\qtbase\mkspecs\msvc-desktop.conf and replaced every -MD by -MT
      Build process went fine.

      If you changed the Qt compilation flags at some point, did you clean out absolutely everything before rebuilding? Many times it seems bits get left over which have been compiled with previous flags.

      1 Reply Last reply
      1
      • E Offline
        E Offline
        ELINAROBIN
        Banned
        wrote on 20 Jul 2018, 20:47 last edited by
        #3
        This post is deleted!
        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