Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qmake SUBDIRS and diamond dependencies
Qt 6.12 LTS is out! See what's new in the release blog

qmake SUBDIRS and diamond dependencies

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
23 Posts 4 Posters 6.4k 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.
  • aha_1980A aha_1980

    @guerinoni Sorry, but a template using CONFIG+=ordered cannot be considered useful!

    Again: https://blog.rburchell.com/2013/10/every-time-you-configordered-kitten-dies.html

    Regads

    K Offline
    K Offline
    koahnig
    wrote on last edited by
    #12

    @aha_1980 said in qmake SUBDIRS and diamond dependencies:

    @guerinoni Sorry, but a template using CONFIG+=ordered cannot be considered useful!

    Again: https://blog.rburchell.com/2013/10/every-time-you-configordered-kitten-dies.html

    Regads

    The referenced article is a good read. At least there is an argument that you might kill the multi-core capability with ordered statement.

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    2
    • aha_1980A aha_1980

      @guerinoni Sorry, but a template using CONFIG+=ordered cannot be considered useful!

      Again: https://blog.rburchell.com/2013/10/every-time-you-configordered-kitten-dies.html

      Regads

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #13

      @aha_1980

      Bad luck.
      I am working currently with the large project in question. Basically I am using "CONFIG += ordered" in 2 subdirs template project files. Both statements have been commented out. All remains of previous qmake and adjacent compilations removed. Ran qmake and started build. It stopped pretty quickly. The hierachy is obviously not recognized because make complaints that the recipe for one of the targets is missing.
      The same done and either of the statements reactivated. Basically the same problems remain, but certainly with different targets in complaints.

      I am using
      SUBDIRS += statements
      .subdir = statements
      .depends = statements

      Especially the .depends statements shall be fine.
      SUBDIRS += has the sequence of projects from deep down libs up to the applications requiring those libs. That exact sequence I would use when I have to recompile manually.

      My conclusion remains that the ordered statements are required. When those 2 statements have been reactivated, the whole compilation went smoothly through.

      Vote the answer(s) that helped you to solve your issue(s)

      aha_1980A 1 Reply Last reply
      0
      • K koahnig

        @aha_1980

        Bad luck.
        I am working currently with the large project in question. Basically I am using "CONFIG += ordered" in 2 subdirs template project files. Both statements have been commented out. All remains of previous qmake and adjacent compilations removed. Ran qmake and started build. It stopped pretty quickly. The hierachy is obviously not recognized because make complaints that the recipe for one of the targets is missing.
        The same done and either of the statements reactivated. Basically the same problems remain, but certainly with different targets in complaints.

        I am using
        SUBDIRS += statements
        .subdir = statements
        .depends = statements

        Especially the .depends statements shall be fine.
        SUBDIRS += has the sequence of projects from deep down libs up to the applications requiring those libs. That exact sequence I would use when I have to recompile manually.

        My conclusion remains that the ordered statements are required. When those 2 statements have been reactivated, the whole compilation went smoothly through.

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #14

        @koahnig

        Please show your .pro file.

        My conclusion remains that the ordered statements are required.

        It is definitely not required(1), and it kills parallel builds. That said, even in some Qt modules (e.g. websockets), you'll find this statement. Replacing it with proper dependency code seems to be an advanced topic ;)

        Regards

        (1) It took me some time to make the parallel build of a company project sane. The problems occurred because I did not understand the qmake Syntax and had errors within.

        Qt has to stay free or it will die.

        K 1 Reply Last reply
        0
        • aha_1980A aha_1980

          @koahnig

          Please show your .pro file.

          My conclusion remains that the ordered statements are required.

          It is definitely not required(1), and it kills parallel builds. That said, even in some Qt modules (e.g. websockets), you'll find this statement. Replacing it with proper dependency code seems to be an advanced topic ;)

          Regards

          (1) It took me some time to make the parallel build of a company project sane. The problems occurred because I did not understand the qmake Syntax and had errors within.

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #15

          @aha_1980

          It is getting ridiculous.

          TEMPLATE = subdirs
          
          SUBDIRS = App4Dll
          SUBDIRS += Dll4Dll
          SUBDIRS += dll_DO_
          
          # where to find the sub projects - give the folders
          App4Dll.subdir    = ./App4Dll
          Dll4Dll.subdir    = ./Dll4Dll
          dll_DO_.subdir          = ./dll_DO_
          
          # what subproject depends on others
          App4Dll.depends = Dll4Dll
          Dll4Dll.depends = dll_DO_
          
          CONFIG += ordered
          

          That is all boiled down to the basic functionality. It should do all I need. dll_DO_ is another subdirs template. All sequence stuff is already reversed.
          As shown as above qmake is working. When last line is commented, it will not worked anymore.
          Error message is:

          18:59:23: Running steps for project ESAndroid...
          18:59:23: Starting: "C:\Qt\5.14.1\android\bin\qmake.exe" E:\Source\Android\E\ES\ESAndroid.pro -spec android-clang "CONFIG+=qtquickcompiler" ANDROID_ABIS="armeabi-v7a"
          18:59:23: The process "C:\Qt\5.14.1\android\bin\qmake.exe" exited normally.
          18:59:23: Starting: "f:\Android\Sdk4Qt5.14.1\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" -f r:/build-ESAndroid-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_1_for_Android-Release/Makefile qmake_all
          make: *** No rule to make target 'sub---Dll4Dll-qmake_all', needed by 'sub-App4Dll-qmake_all'.  Stop.
          18:59:23: The process "f:\Android\Sdk4Qt5.14.1\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.
          Error while building/deploying project ESAndroid (kit: Android for armeabi-v7a,arm64-v8a,x86,x86_64 (Clang Qt 5.14.1 for Android))
          When executing step "qmake"
          18:59:23: Elapsed time: 00:00.
          

          Vote the answer(s) that helped you to solve your issue(s)

          aha_1980A 1 Reply Last reply
          0
          • K koahnig

            @aha_1980

            It is getting ridiculous.

            TEMPLATE = subdirs
            
            SUBDIRS = App4Dll
            SUBDIRS += Dll4Dll
            SUBDIRS += dll_DO_
            
            # where to find the sub projects - give the folders
            App4Dll.subdir    = ./App4Dll
            Dll4Dll.subdir    = ./Dll4Dll
            dll_DO_.subdir          = ./dll_DO_
            
            # what subproject depends on others
            App4Dll.depends = Dll4Dll
            Dll4Dll.depends = dll_DO_
            
            CONFIG += ordered
            

            That is all boiled down to the basic functionality. It should do all I need. dll_DO_ is another subdirs template. All sequence stuff is already reversed.
            As shown as above qmake is working. When last line is commented, it will not worked anymore.
            Error message is:

            18:59:23: Running steps for project ESAndroid...
            18:59:23: Starting: "C:\Qt\5.14.1\android\bin\qmake.exe" E:\Source\Android\E\ES\ESAndroid.pro -spec android-clang "CONFIG+=qtquickcompiler" ANDROID_ABIS="armeabi-v7a"
            18:59:23: The process "C:\Qt\5.14.1\android\bin\qmake.exe" exited normally.
            18:59:23: Starting: "f:\Android\Sdk4Qt5.14.1\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" -f r:/build-ESAndroid-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_1_for_Android-Release/Makefile qmake_all
            make: *** No rule to make target 'sub---Dll4Dll-qmake_all', needed by 'sub-App4Dll-qmake_all'.  Stop.
            18:59:23: The process "f:\Android\Sdk4Qt5.14.1\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.
            Error while building/deploying project ESAndroid (kit: Android for armeabi-v7a,arm64-v8a,x86,x86_64 (Clang Qt 5.14.1 for Android))
            When executing step "qmake"
            18:59:23: Elapsed time: 00:00.
            
            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #16

            @koahnig said in qmake SUBDIRS and diamond dependencies:

            App4Dll.subdir = ./App4Dll
            Dll4Dll.subdir = ./Dll4Dll
            dll_DO_.subdir = ./dll_DO_

            These are your problems, 99% sure.

            Please show the corresponding directory structure, and where all the pro files live.

            Qt has to stay free or it will die.

            K 1 Reply Last reply
            0
            • aha_1980A aha_1980

              @koahnig said in qmake SUBDIRS and diamond dependencies:

              App4Dll.subdir = ./App4Dll
              Dll4Dll.subdir = ./Dll4Dll
              dll_DO_.subdir = ./dll_DO_

              These are your problems, 99% sure.

              Please show the corresponding directory structure, and where all the pro files live.

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #17

              @aha_1980

              You were pretty fast ;)

              Here is the structure. For first dir of folder some entries removed.

               Datentr„ger in Laufwerk E: ist DATA
               Volumeseriennummer: C265-8340
              
               Verzeichnis von e:\Source\Android\E\ES
              
              26.02.2020  19:11    <DIR>          .
              26.02.2020  19:11    <DIR>          ..
              26.02.2020  18:35    <DIR>          App4Dll
              26.02.2020  19:11                 0 aus
              25.02.2020  19:01               689 config.xml
              28.10.2018  13:36               777 config_xml.in
              26.02.2020  18:36    <DIR>          Dll4Dll
              26.02.2020  15:08    <DIR>          dll_DO_
              26.02.2020  18:58               354 ESAndroid.pro
              21.02.2020  18:36           101'017 ESAndroid.pro.user
                             8 Datei(en),        235'801 Bytes
                            12 Verzeichnis(se), 137'678'741'504 Bytes frei
               Datentr„ger in Laufwerk E: ist DATA
               Volumeseriennummer: C265-8340
              
               Verzeichnis von e:\Source\Android\E\ES\App4Dll
              
              26.02.2020  18:35    <DIR>          .
              26.02.2020  18:35    <DIR>          ..
              25.02.2020  16:08             5'376 App4Dll.pro
                             1 Datei(en),          5'376 Bytes
                             2 Verzeichnis(se), 137'678'741'504 Bytes frei
               Datentr„ger in Laufwerk E: ist DATA
               Volumeseriennummer: C265-8340
              
               Verzeichnis von e:\Source\Android\E\ES\Dll4Dll
              
              26.02.2020  18:36    <DIR>          .
              26.02.2020  18:36    <DIR>          ..
              24.02.2020  13:17             4'063 Dll4Dll.pro
                             1 Datei(en),          4'063 Bytes
                             2 Verzeichnis(se), 137'678'741'504 Bytes frei
               Datentr„ger in Laufwerk E: ist DATA
               Volumeseriennummer: C265-8340
              
               Verzeichnis von e:\Source\Android\E\ES\dll_DO_
              
              26.02.2020  15:08    <DIR>          .
              26.02.2020  15:08    <DIR>          ..
              26.02.2020  15:08             2'076 dll_DO_.pro
              25.02.2020  19:01    <DIR>          EDll
              25.02.2020  19:01    <DIR>          IDll
              25.02.2020  19:01    <DIR>          NBDll
              25.02.2020  19:01    <DIR>          NDll
              25.02.2020  19:01    <DIR>          NIDll
              25.02.2020  19:01    <DIR>          NLibDO_
              22.02.2020  12:04    <DIR>          QNtp
              25.02.2020  19:01    <DIR>          RLDO_A
              25.02.2020  19:01    <DIR>          RLDO_Bs
              25.02.2020  19:01    <DIR>          RLDO_Br
              25.02.2020  19:01    <DIR>          RLDO_M
              25.02.2020  19:01    <DIR>          RLDO_NR
              25.02.2020  19:01    <DIR>          RLDO_OO
              25.02.2020  19:01    <DIR>          RLDO_Ssr
              25.02.2020  19:01    <DIR>          SDll
                             1 Datei(en),          2'076 Bytes
                            17 Verzeichnis(se), 137'678'741'504 Bytes frei
              

              Vote the answer(s) that helped you to solve your issue(s)

              aha_1980A 1 Reply Last reply
              0
              • K koahnig

                @aha_1980

                You were pretty fast ;)

                Here is the structure. For first dir of folder some entries removed.

                 Datentr„ger in Laufwerk E: ist DATA
                 Volumeseriennummer: C265-8340
                
                 Verzeichnis von e:\Source\Android\E\ES
                
                26.02.2020  19:11    <DIR>          .
                26.02.2020  19:11    <DIR>          ..
                26.02.2020  18:35    <DIR>          App4Dll
                26.02.2020  19:11                 0 aus
                25.02.2020  19:01               689 config.xml
                28.10.2018  13:36               777 config_xml.in
                26.02.2020  18:36    <DIR>          Dll4Dll
                26.02.2020  15:08    <DIR>          dll_DO_
                26.02.2020  18:58               354 ESAndroid.pro
                21.02.2020  18:36           101'017 ESAndroid.pro.user
                               8 Datei(en),        235'801 Bytes
                              12 Verzeichnis(se), 137'678'741'504 Bytes frei
                 Datentr„ger in Laufwerk E: ist DATA
                 Volumeseriennummer: C265-8340
                
                 Verzeichnis von e:\Source\Android\E\ES\App4Dll
                
                26.02.2020  18:35    <DIR>          .
                26.02.2020  18:35    <DIR>          ..
                25.02.2020  16:08             5'376 App4Dll.pro
                               1 Datei(en),          5'376 Bytes
                               2 Verzeichnis(se), 137'678'741'504 Bytes frei
                 Datentr„ger in Laufwerk E: ist DATA
                 Volumeseriennummer: C265-8340
                
                 Verzeichnis von e:\Source\Android\E\ES\Dll4Dll
                
                26.02.2020  18:36    <DIR>          .
                26.02.2020  18:36    <DIR>          ..
                24.02.2020  13:17             4'063 Dll4Dll.pro
                               1 Datei(en),          4'063 Bytes
                               2 Verzeichnis(se), 137'678'741'504 Bytes frei
                 Datentr„ger in Laufwerk E: ist DATA
                 Volumeseriennummer: C265-8340
                
                 Verzeichnis von e:\Source\Android\E\ES\dll_DO_
                
                26.02.2020  15:08    <DIR>          .
                26.02.2020  15:08    <DIR>          ..
                26.02.2020  15:08             2'076 dll_DO_.pro
                25.02.2020  19:01    <DIR>          EDll
                25.02.2020  19:01    <DIR>          IDll
                25.02.2020  19:01    <DIR>          NBDll
                25.02.2020  19:01    <DIR>          NDll
                25.02.2020  19:01    <DIR>          NIDll
                25.02.2020  19:01    <DIR>          NLibDO_
                22.02.2020  12:04    <DIR>          QNtp
                25.02.2020  19:01    <DIR>          RLDO_A
                25.02.2020  19:01    <DIR>          RLDO_Bs
                25.02.2020  19:01    <DIR>          RLDO_Br
                25.02.2020  19:01    <DIR>          RLDO_M
                25.02.2020  19:01    <DIR>          RLDO_NR
                25.02.2020  19:01    <DIR>          RLDO_OO
                25.02.2020  19:01    <DIR>          RLDO_Ssr
                25.02.2020  19:01    <DIR>          SDll
                               1 Datei(en),          2'076 Bytes
                              17 Verzeichnis(se), 137'678'741'504 Bytes frei
                
                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by aha_1980
                #18

                @koahnig I happened to be around.

                So, your subdirs have the same name as your pro files, like App4Dll/App4Dll.pro.

                I repeat it: in this case, the App4Dll.subdir line is superflous (and probably wrong, because this is hard to get right).

                As next step, remove these completely:

                App4Dll.subdir = ./App4Dll
                Dll4Dll.subdir = ./Dll4Dll
                dll_DO_.subdir = ./dll_DO_
                

                Also remove CONFIG+=ordered, clean everything and then rerun qmake and make.

                It should work.

                Qt has to stay free or it will die.

                K 1 Reply Last reply
                1
                • aha_1980A aha_1980

                  @koahnig I happened to be around.

                  So, your subdirs have the same name as your pro files, like App4Dll/App4Dll.pro.

                  I repeat it: in this case, the App4Dll.subdir line is superflous (and probably wrong, because this is hard to get right).

                  As next step, remove these completely:

                  App4Dll.subdir = ./App4Dll
                  Dll4Dll.subdir = ./Dll4Dll
                  dll_DO_.subdir = ./dll_DO_
                  

                  Also remove CONFIG+=ordered, clean everything and then rerun qmake and make.

                  It should work.

                  K Offline
                  K Offline
                  koahnig
                  wrote on last edited by
                  #19

                  @aha_1980

                  TEMPLATE = subdirs
                  
                  SUBDIRS = App4Dll
                  SUBDIRS += Dll4Dll
                  SUBDIRS += dll_DO_
                  
                  # where to find the sub projects - give the folders
                  #App4Dll.subdir    = ./App4Dll
                  #Dll4Dll.subdir    = ./Dll4Dll
                  #dll_DO_.subdir          = ./dll_DO_
                  
                  # what subproject depends on others
                  App4Dll.depends = Dll4Dll
                  Dll4Dll.depends = dll_DO_
                  
                  #CONFIG += ordered
                  

                  This does work 8|
                  You are correct. Unbelievable.
                  Just ran qmake from creator and it worked. Also did a full compilation of my project.

                  Thanks a lot for the hint.

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  1
                  • K Offline
                    K Offline
                    koahnig
                    wrote on last edited by
                    #20

                    I have modified also dll_DO_.pro which is also based on subdirs template.

                    The whole compilation with ordered modifier is sped up from approximately 9:30 to around 7:45. Therefore there is a significant increase in compilation speed of about 20-25% on an eight core Windows 64 bit machine for that specific project and tool chain.

                    However, as it turns out the use of .subdir does not work. I have 15 different subfolders and 1 of them would require the .subdir specification, since the name used in SUBDIRS has been different. However, I had to modify the name in SUBDIRS to make it homogenous with the subprojects. Otherwise the ordered modifier was required.

                    Vote the answer(s) that helped you to solve your issue(s)

                    1 Reply Last reply
                    0
                    • aha_1980A aha_1980

                      @HendrikGerloff

                      I don't see a big problem in solving this dependency.

                      I guess the src.file = src/src.pro lines are the problem, as most often has been for me.

                      The best tip I can give you: put all subdirs into a subdirectory with a pro file of the the same name, e.g. src/ with src/src.pro.

                      In that case, the sub.file line is even unneeded!

                      So the problems are most likely the a...c subdirs.

                      You can manage that with an hierarchy of subdirs:

                      main.pro (SUBDIRS)
                      SUBDIRS += src
                      
                      src/src.pro (SUBDIRS)
                      SUBDIRS += src aSub bSub cSub
                      
                      src.depends += aSub
                      src.depends += cSub
                      
                      aSub.depends += cSub
                      bSub.depends += cSub
                      
                      src/src/src.pro (app)
                      
                      src/baSub/aSub.pro (lib)
                      
                      src/bSub/bSub.pro (lib)
                      
                      src/cSub/cSub.pro (lib)
                      

                      I hope you got the idea.

                      Regards

                      H Offline
                      H Offline
                      HendrikGerloff
                      wrote on last edited by
                      #21

                      @aha_1980 said in qmake SUBDIRS and diamond dependencies:

                      @HendrikGerloff

                      I don't see a big problem in solving this dependency.

                      I guess the src.file = src/src.pro lines are the problem, as most often has been for me.

                      The best tip I can give you: put all subdirs into a subdirectory with a pro file of the the same name, e.g. src/ with src/src.pro.

                      In that case, the sub.file line is even unneeded!

                      So the problems are most likely the a...c subdirs.

                      You can manage that with an hierarchy of subdirs:

                      main.pro (SUBDIRS)
                      SUBDIRS += src
                      
                      src/src.pro (SUBDIRS)
                      SUBDIRS += src aSub bSub cSub
                      
                      src.depends += aSub
                      src.depends += cSub
                      
                      aSub.depends += cSub
                      bSub.depends += cSub
                      
                      src/src/src.pro (app)
                      
                      src/baSub/aSub.pro (lib)
                      
                      src/bSub/bSub.pro (lib)
                      
                      src/cSub/cSub.pro (lib)
                      

                      I hope you got the idea.

                      Regards

                      But I still have to manage all dependencies in my top level pro file, right? That was what I wanted to avoid. I hoped that I could define the dependencies in the sub pro files.

                      1 Reply Last reply
                      0
                      • guerinoniG guerinoni

                        @HendrikGerloff
                        if you want you can check my boilerpalte https://github.com/guerinoni/cpp-qt-project-structure-template.git

                        H Offline
                        H Offline
                        HendrikGerloff
                        wrote on last edited by
                        #22

                        @guerinoni said in qmake SUBDIRS and diamond dependencies:

                        @HendrikGerloff
                        if you want you can check my boilerpalte https://github.com/guerinoni/cpp-qt-project-structure-template.git

                        You template does not work without CONFIG += ordered so it does not really solve my problem. My problem is that 2 modules both depend on another module which is build twice / at the same time when using more than one core.

                        guerinoniG 1 Reply Last reply
                        0
                        • H HendrikGerloff

                          @guerinoni said in qmake SUBDIRS and diamond dependencies:

                          @HendrikGerloff
                          if you want you can check my boilerpalte https://github.com/guerinoni/cpp-qt-project-structure-template.git

                          You template does not work without CONFIG += ordered so it does not really solve my problem. My problem is that 2 modules both depend on another module which is build twice / at the same time when using more than one core.

                          guerinoniG Offline
                          guerinoniG Offline
                          guerinoni
                          wrote on last edited by
                          #23

                          @HendrikGerloff I know, maybe my structure is something legacy but it works fine for my jobs... also qt-creator using this for qmake... for the future I am going to use only cmake

                          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
                          • Unsolved