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. [Qt6][Windows] How To Clean Build in Source Dir
Forum Update on Monday, May 27th 2025

[Qt6][Windows] How To Clean Build in Source Dir

Scheduled Pinned Locked Moved Solved Installation and Deployment
5 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.
  • BosGemilerB Offline
    BosGemilerB Offline
    BosGemiler
    wrote on last edited by
    #1

    Hi all,

    I am trying to build Qt6 source statically on Windows platform. After configuration is done, I got some errors in build step. And I want to clean my build directory before rebuild.

    In Qt docs, it is described as ;
    If you later need to reconfigure and rebuild Qt from the same location, ensure that all traces of the previous configuration are removed by entering the build directory and running nmake distclean or mingw32-make distclean before running configure again.

    But there is no any makefile in my source directory to be able run. As a result when I tried to run mingw32-make distclean I receive an error that makefile couldn't find.

    How can I clean my build directory before rebuilding ? Why don't I have a makefile in my build folder ?

    Meanwhile, I tried to make clean with cmake with below command. But I think that's not what I need.

    >cmake --build . --target clean
    [2/2] Cleaning all built files...
    Cleaning... 486 files.
    

    Configure and build commands I have used ;

    >configure -static -release -prefix C:\QtStatic -skip qttranslations,qtdoc,qttools,qt3d,qtlanguageserver,qtmqtt,qtmultimedia,qtquick3d,qtquicktimeline,qtsensors,qtvirtualkeyboard,qtwebchannel,qtwebsockets,qtwebview
    
    >cmake --build . --parallel
    

    You can see my source directory below.

    06/13/2023  01:10 AM    <DIR>          .
    06/13/2023  01:10 AM    <DIR>          ..
    09/07/2022  03:40 PM             6,951 .gitmodules
    06/13/2023  12:55 AM               719 .ninja_log
    06/13/2023  12:54 AM    <DIR>          .qt
    09/07/2022  06:20 PM           108,239 .QT-ENTERPRISE-LICENSE-AGREEMENT
    09/07/2022  03:40 PM                42 .tag
    06/13/2023  12:54 AM        23,880,454 build.ninja
    06/13/2023  12:18 AM    <DIR>          cmake
    06/13/2023  12:53 AM           215,804 CMakeCache.txt
    06/13/2023  12:54 AM    <DIR>          CMakeFiles
    09/07/2022  03:40 PM             4,211 CMakeLists.txt
    06/13/2023  12:54 AM             4,914 cmake_install.cmake
    06/13/2023  12:18 AM    <DIR>          coin
    09/07/2022  03:40 PM             2,040 conanfile_profiles.py
    06/13/2023  12:51 AM               210 config.opt
    06/13/2023  12:51 AM               216 config.opt.in
    06/13/2023  12:53 AM            11,740 config.summary
    06/13/2023  12:53 AM    <DIR>          config.tests
    09/07/2022  03:40 PM             1,610 configure
    09/07/2022  03:40 PM             1,721 configure.bat
    09/07/2022  03:40 PM               101 configure.json
    06/13/2023  12:54 AM               739 CTestTestfile.cmake
    09/07/2022  03:40 PM            18,431 LICENSE.GPL2
    09/07/2022  03:40 PM            35,821 LICENSE.GPL3
    09/07/2022  03:40 PM            37,067 LICENSE.GPL3-EXCEPT
    09/07/2022  03:40 PM             7,816 LICENSE.LGPL3
    09/07/2022  03:40 PM           108,239 LICENSE.QT-LICENSE-AGREEMENT
    06/13/2023  12:18 AM    <DIR>          qt3d
    06/13/2023  12:54 AM    <DIR>          qt5compat
    06/13/2023  01:10 AM                 0 qt6vars.cmd.txt
    06/13/2023  12:54 AM    <DIR>          qtactiveqt
    06/13/2023  12:54 AM    <DIR>          qtbase
    06/13/2023  12:54 AM    <DIR>          qtcharts
    06/13/2023  12:54 AM    <DIR>          qtcoap
    06/13/2023  12:54 AM    <DIR>          qtconnectivity
    06/13/2023  12:54 AM    <DIR>          qtdatavis3d
    06/13/2023  12:54 AM    <DIR>          qtdeclarative
    06/13/2023  12:22 AM    <DIR>          qtdoc
    06/13/2023  12:54 AM    <DIR>          qtimageformats
    06/13/2023  12:22 AM    <DIR>          qtlanguageserver
    06/13/2023  12:54 AM    <DIR>          qtlottie
    06/13/2023  12:22 AM    <DIR>          qtmqtt
    06/13/2023  12:22 AM    <DIR>          qtmultimedia
    06/13/2023  12:54 AM    <DIR>          qtnetworkauth
    06/13/2023  12:54 AM    <DIR>          qtopcua
    06/13/2023  12:54 AM    <DIR>          qtpositioning
    06/13/2023  12:22 AM    <DIR>          qtquick3d
    06/13/2023  12:22 AM    <DIR>          qtquicktimeline
    06/13/2023  12:54 AM    <DIR>          qtremoteobjects
    06/13/2023  12:54 AM    <DIR>          qtscxml
    06/13/2023  12:22 AM    <DIR>          qtsensors
    06/13/2023  12:54 AM    <DIR>          qtserialbus
    06/13/2023  12:54 AM    <DIR>          qtserialport
    06/13/2023  12:54 AM    <DIR>          qtshadertools
    06/13/2023  12:54 AM    <DIR>          qtsvg
    06/13/2023  12:22 AM    <DIR>          qttools
    06/13/2023  12:22 AM    <DIR>          qttranslations
    06/13/2023  12:22 AM    <DIR>          qtvirtualkeyboard
    06/13/2023  12:54 AM    <DIR>          qtwayland
    06/13/2023  12:23 AM    <DIR>          qtwebchannel
    06/13/2023  12:54 AM    <DIR>          qtwebengine
    06/13/2023  12:31 AM    <DIR>          qtwebsockets
    06/13/2023  12:31 AM    <DIR>          qtwebview
    09/07/2022  03:40 PM             3,126 README.md
    09/07/2022  03:40 PM             3,061 _clang-format
                  24 File(s)     24,453,272 bytes
                  42 Dir(s)  87,016,062,976 bytes frees
    
    jsulmJ 1 Reply Last reply
    0
    • BosGemilerB BosGemiler

      Hi all,

      I am trying to build Qt6 source statically on Windows platform. After configuration is done, I got some errors in build step. And I want to clean my build directory before rebuild.

      In Qt docs, it is described as ;
      If you later need to reconfigure and rebuild Qt from the same location, ensure that all traces of the previous configuration are removed by entering the build directory and running nmake distclean or mingw32-make distclean before running configure again.

      But there is no any makefile in my source directory to be able run. As a result when I tried to run mingw32-make distclean I receive an error that makefile couldn't find.

      How can I clean my build directory before rebuilding ? Why don't I have a makefile in my build folder ?

      Meanwhile, I tried to make clean with cmake with below command. But I think that's not what I need.

      >cmake --build . --target clean
      [2/2] Cleaning all built files...
      Cleaning... 486 files.
      

      Configure and build commands I have used ;

      >configure -static -release -prefix C:\QtStatic -skip qttranslations,qtdoc,qttools,qt3d,qtlanguageserver,qtmqtt,qtmultimedia,qtquick3d,qtquicktimeline,qtsensors,qtvirtualkeyboard,qtwebchannel,qtwebsockets,qtwebview
      
      >cmake --build . --parallel
      

      You can see my source directory below.

      06/13/2023  01:10 AM    <DIR>          .
      06/13/2023  01:10 AM    <DIR>          ..
      09/07/2022  03:40 PM             6,951 .gitmodules
      06/13/2023  12:55 AM               719 .ninja_log
      06/13/2023  12:54 AM    <DIR>          .qt
      09/07/2022  06:20 PM           108,239 .QT-ENTERPRISE-LICENSE-AGREEMENT
      09/07/2022  03:40 PM                42 .tag
      06/13/2023  12:54 AM        23,880,454 build.ninja
      06/13/2023  12:18 AM    <DIR>          cmake
      06/13/2023  12:53 AM           215,804 CMakeCache.txt
      06/13/2023  12:54 AM    <DIR>          CMakeFiles
      09/07/2022  03:40 PM             4,211 CMakeLists.txt
      06/13/2023  12:54 AM             4,914 cmake_install.cmake
      06/13/2023  12:18 AM    <DIR>          coin
      09/07/2022  03:40 PM             2,040 conanfile_profiles.py
      06/13/2023  12:51 AM               210 config.opt
      06/13/2023  12:51 AM               216 config.opt.in
      06/13/2023  12:53 AM            11,740 config.summary
      06/13/2023  12:53 AM    <DIR>          config.tests
      09/07/2022  03:40 PM             1,610 configure
      09/07/2022  03:40 PM             1,721 configure.bat
      09/07/2022  03:40 PM               101 configure.json
      06/13/2023  12:54 AM               739 CTestTestfile.cmake
      09/07/2022  03:40 PM            18,431 LICENSE.GPL2
      09/07/2022  03:40 PM            35,821 LICENSE.GPL3
      09/07/2022  03:40 PM            37,067 LICENSE.GPL3-EXCEPT
      09/07/2022  03:40 PM             7,816 LICENSE.LGPL3
      09/07/2022  03:40 PM           108,239 LICENSE.QT-LICENSE-AGREEMENT
      06/13/2023  12:18 AM    <DIR>          qt3d
      06/13/2023  12:54 AM    <DIR>          qt5compat
      06/13/2023  01:10 AM                 0 qt6vars.cmd.txt
      06/13/2023  12:54 AM    <DIR>          qtactiveqt
      06/13/2023  12:54 AM    <DIR>          qtbase
      06/13/2023  12:54 AM    <DIR>          qtcharts
      06/13/2023  12:54 AM    <DIR>          qtcoap
      06/13/2023  12:54 AM    <DIR>          qtconnectivity
      06/13/2023  12:54 AM    <DIR>          qtdatavis3d
      06/13/2023  12:54 AM    <DIR>          qtdeclarative
      06/13/2023  12:22 AM    <DIR>          qtdoc
      06/13/2023  12:54 AM    <DIR>          qtimageformats
      06/13/2023  12:22 AM    <DIR>          qtlanguageserver
      06/13/2023  12:54 AM    <DIR>          qtlottie
      06/13/2023  12:22 AM    <DIR>          qtmqtt
      06/13/2023  12:22 AM    <DIR>          qtmultimedia
      06/13/2023  12:54 AM    <DIR>          qtnetworkauth
      06/13/2023  12:54 AM    <DIR>          qtopcua
      06/13/2023  12:54 AM    <DIR>          qtpositioning
      06/13/2023  12:22 AM    <DIR>          qtquick3d
      06/13/2023  12:22 AM    <DIR>          qtquicktimeline
      06/13/2023  12:54 AM    <DIR>          qtremoteobjects
      06/13/2023  12:54 AM    <DIR>          qtscxml
      06/13/2023  12:22 AM    <DIR>          qtsensors
      06/13/2023  12:54 AM    <DIR>          qtserialbus
      06/13/2023  12:54 AM    <DIR>          qtserialport
      06/13/2023  12:54 AM    <DIR>          qtshadertools
      06/13/2023  12:54 AM    <DIR>          qtsvg
      06/13/2023  12:22 AM    <DIR>          qttools
      06/13/2023  12:22 AM    <DIR>          qttranslations
      06/13/2023  12:22 AM    <DIR>          qtvirtualkeyboard
      06/13/2023  12:54 AM    <DIR>          qtwayland
      06/13/2023  12:23 AM    <DIR>          qtwebchannel
      06/13/2023  12:54 AM    <DIR>          qtwebengine
      06/13/2023  12:31 AM    <DIR>          qtwebsockets
      06/13/2023  12:31 AM    <DIR>          qtwebview
      09/07/2022  03:40 PM             3,126 README.md
      09/07/2022  03:40 PM             3,061 _clang-format
                    24 File(s)     24,453,272 bytes
                    42 Dir(s)  87,016,062,976 bytes frees
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @BosGemiler said in [Qt6][Windows] How To Clean Build in Source Dir:

      But there is no any makefile in my source directory to be able run

      Not source directory, "build directory". Build directory is the folder from which your calling configure and cmake.

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

      BosGemilerB 1 Reply Last reply
      1
      • jsulmJ jsulm

        @BosGemiler said in [Qt6][Windows] How To Clean Build in Source Dir:

        But there is no any makefile in my source directory to be able run

        Not source directory, "build directory". Build directory is the folder from which your calling configure and cmake.

        BosGemilerB Offline
        BosGemilerB Offline
        BosGemiler
        wrote on last edited by
        #3

        @jsulm Hi,

        you are right. But I used Src folder as Build directory in this case. In linux, the build directory was the path in where I call configure. But when I tried it in Windows, I couldn't achieve the same result, somehow all outputs are extracted to Src folder.

        I tried it again. First, I create a build dir, and moved to this path in cmd, and then run configure, and I saw in output prints that build files are located to Src folder.

        >Build files have been written to: C:/Qt/6.3.2/Src
        

        and the files in build dir ;

        qtbase, config.opt, config.opt.in 
        
        jsulmJ 1 Reply Last reply
        0
        • BosGemilerB BosGemiler

          @jsulm Hi,

          you are right. But I used Src folder as Build directory in this case. In linux, the build directory was the path in where I call configure. But when I tried it in Windows, I couldn't achieve the same result, somehow all outputs are extracted to Src folder.

          I tried it again. First, I create a build dir, and moved to this path in cmd, and then run configure, and I saw in output prints that build files are located to Src folder.

          >Build files have been written to: C:/Qt/6.3.2/Src
          

          and the files in build dir ;

          qtbase, config.opt, config.opt.in 
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @BosGemiler said in [Qt6][Windows] How To Clean Build in Source Dir:

          But I used Src folder as Build directory in this case

          Which is bad. So in what directory are you exactly when you call configure? All the configure/build artefacts are in that directory.
          And actually there is build.ninja file generated in the folder you're showing which means that you're using Ninja to build.

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

          BosGemilerB 1 Reply Last reply
          0
          • jsulmJ jsulm

            @BosGemiler said in [Qt6][Windows] How To Clean Build in Source Dir:

            But I used Src folder as Build directory in this case

            Which is bad. So in what directory are you exactly when you call configure? All the configure/build artefacts are in that directory.
            And actually there is build.ninja file generated in the folder you're showing which means that you're using Ninja to build.

            BosGemilerB Offline
            BosGemilerB Offline
            BosGemiler
            wrote on last edited by
            #5

            @jsulm said

            Which is bad.

            Definitely :)
            Okay, I removed Src folder and reinstalled it via qt-maintenance tool. Then, I followed same steps again to configure & build. Now, I can see outputs in my Build dir as expected.

            1 Reply Last reply
            1
            • BosGemilerB BosGemiler has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved