Please nominate your Qt Champions for 2021!

Problem building qt static on win 10

  • I am trying to build a static version of qt on win 10 and get the following error:

    C:\Qt\5.12.2\Src\qtbase\src\corelib\global\qlibraryinfo.cpp: fatal error C1853: 'qmake_pch.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)

    This is surprising since I configured to not use precompiled headers. Here is how I am building the system if this gives any clues, or any of my configure options may be wrong

    "\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

    configure -static -release -no-pch -platform win32-msvc2017 -confirm-license -prefix "\QtStatic" -opensource -mp -nomake examples -nomake tests -no-icu -no-opengl -no-angle -no-openssl -skip webengine

    Any help would be welcome....

  • Lifetime Qt Champion

    Did you use a clean source and build directory or did you compile with other options before in there?

  • @Christian-Ehrlicher
    It was clean at the beginning, although I have fiddled around with having or not having -no-pch since then. I will nuke the C:\Qt\5.12.2\Src directory and try again, but this will take a few hours.

  • @Christian-Ehrlicher
    OK. My mistake. I deleted the sources using the maintenance tool, deleted what was left in the Src directory, downloaded, and executed the two commands - and it built perfectly. So I must have done something wrong along the way. I see now the the qmake_pch.pch is build in the configure stage not the nmake stage, so it must have been me who built it with the wrong compiler.

    Apologies for wasting your time. I should have had the sense to rebuild from scratch without needing to be prompted.

Log in to reply