Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. The build directory needs to be at the same level as the source directory.
Qt 6.11 is out! See what's new in the release blog

The build directory needs to be at the same level as the source directory.

Scheduled Pinned Locked Moved Unsolved General and Desktop
26 Posts 8 Posters 20.5k Views 7 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.
  • ModelTechM Offline
    ModelTechM Offline
    ModelTech
    wrote on last edited by
    #1

    Just updated my Qt and Qt creator to the latest version and now I get the warning message "Warning: The build directory needs to be at the same level as the source directory." Why would having the build directory at the same level as the source directory desirable?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Does it also say so with a new project?
      if, no, then try to delete the .pro.user for the project in question.

      1 Reply Last reply
      0
      • ModelTechM Offline
        ModelTechM Offline
        ModelTech
        wrote on last edited by
        #3

        The message also appears if I remove the .pro.user file. For a new project, I already get the same warning when configuring the build settings.

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

          ok. i also just updated and get none such warning no matter how i set
          build folder. with or without shadow build.

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

            Hi,

            What version of Qt ? Qt Creator ? OS ?

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

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jax1157
              wrote on last edited by
              #6

              Having the same issue too (just showed up since the update).

              • QtCreator 4.1.0
              • Qt 5.7

              Approx code structure:

              • Shadow
                • Project.pro
                • Project.pro.user
                • Various Source Dirs
                • tmp
                  • build_platform_... (where I build to)

              I don't want these directories up 1 level at all (which is what the error seems to be telling me)!!

              Settings build dir is: ./tmp/build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}
              Warning shows up when I build, and also when I configure the project.

              jsulmJ 1 Reply Last reply
              1
              • J jax1157

                Having the same issue too (just showed up since the update).

                • QtCreator 4.1.0
                • Qt 5.7

                Approx code structure:

                • Shadow
                  • Project.pro
                  • Project.pro.user
                  • Various Source Dirs
                  • tmp
                    • build_platform_... (where I build to)

                I don't want these directories up 1 level at all (which is what the error seems to be telling me)!!

                Settings build dir is: ./tmp/build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}
                Warning shows up when I build, and also when I configure the project.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @jax1157 I don't know how to fix this. But it is really much better to keep the binaries outside of your project source tree.

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

                J 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @jax1157 I don't know how to fix this. But it is really much better to keep the binaries outside of your project source tree.

                  J Offline
                  J Offline
                  jax1157
                  wrote on last edited by
                  #8

                  @jsulm The trouble is that if you have all of your shadows in a single place, then the object trees conflict. So, it can be a good idea to keep the shadow contained...

                  Would be better if QMake stopped complaining... It didn't use to...

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jax1157
                    wrote on last edited by
                    #9

                    Extra info:

                    • The operating system is OSX (El Capitan).
                    • Have already tried re-creating .pro.user files but makes no difference.
                    • The error showed up after after upgrading to QtCreator 4.1.0
                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      qmake is innocent. That's a Qt Creator message.

                      Why would the object tree conflict ? Qt Creator generates names that are "unique" to your project for the shadow build. So unless you are building projects with the exact same name using the same kit with the shadow build in the same folder, you should be good.

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

                      J 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        qmake is innocent. That's a Qt Creator message.

                        Why would the object tree conflict ? Qt Creator generates names that are "unique" to your project for the shadow build. So unless you are building projects with the exact same name using the same kit with the shadow build in the same folder, you should be good.

                        J Offline
                        J Offline
                        jax1157
                        wrote on last edited by
                        #11

                        @SGaist

                        The tree conflicts because the names are not unique... If you are building several different branches of the same project, then the kit is the same, as is the project.

                        Also, if you do as you suggest, you end up with a massive mess of build directories littering the directory above the shadows. Not a good situation...

                        Encapsulating the build files in a shadow is pretty common - And like I said, Qt Creator didn't used to complain.

                        kshegunovK 1 Reply Last reply
                        0
                        • J jax1157

                          @SGaist

                          The tree conflicts because the names are not unique... If you are building several different branches of the same project, then the kit is the same, as is the project.

                          Also, if you do as you suggest, you end up with a massive mess of build directories littering the directory above the shadows. Not a good situation...

                          Encapsulating the build files in a shadow is pretty common - And like I said, Qt Creator didn't used to complain.

                          kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by
                          #12

                          @jax1157 said in The build directory needs to be at the same level as the source directory.:

                          And like I said, Qt Creator didn't used to complain.

                          It did. I have encountered it numerous times. This error message is very, very old - an example of a similar thread from the far, far 2011.

                          Also this isn't shadow building. The binaries are under your source tree, whence the message.
                          Structure like this:

                          • build_1
                          • build_2
                          • project dir
                            • projectfile.pro
                            • sourcefile.cpp
                            • headerfile.h
                            • ...

                          Is a shadow build configuration. If you use that structure you won't get the message.

                          Read and abide by the Qt Code of Conduct

                          J 1 Reply Last reply
                          0
                          • kshegunovK kshegunov

                            @jax1157 said in The build directory needs to be at the same level as the source directory.:

                            And like I said, Qt Creator didn't used to complain.

                            It did. I have encountered it numerous times. This error message is very, very old - an example of a similar thread from the far, far 2011.

                            Also this isn't shadow building. The binaries are under your source tree, whence the message.
                            Structure like this:

                            • build_1
                            • build_2
                            • project dir
                              • projectfile.pro
                              • sourcefile.cpp
                              • headerfile.h
                              • ...

                            Is a shadow build configuration. If you use that structure you won't get the message.

                            J Offline
                            J Offline
                            jax1157
                            wrote on last edited by
                            #13

                            @kshegunov Yes - That structure that you have shown there is exactly what we are trying to avoid.

                            kshegunovK 1 Reply Last reply
                            0
                            • J jax1157

                              @kshegunov Yes - That structure that you have shown there is exactly what we are trying to avoid.

                              kshegunovK Offline
                              kshegunovK Offline
                              kshegunov
                              Moderators
                              wrote on last edited by
                              #14

                              @jax1157 said in The build directory needs to be at the same level as the source directory.:

                              Yes - That structure that you have shown there is exactly what we are trying to avoid.

                              If you ask me that's the structure you should be striving for, all builds having all the necessary isolation from one another and being out of the source tree, but that's just my opinion. I don't think you can have "Shadow building" enabled in Creator and have the build folder on a level different from the source.

                              Read and abide by the Qt Code of Conduct

                              J 1 Reply Last reply
                              0
                              • kshegunovK kshegunov

                                @jax1157 said in The build directory needs to be at the same level as the source directory.:

                                Yes - That structure that you have shown there is exactly what we are trying to avoid.

                                If you ask me that's the structure you should be striving for, all builds having all the necessary isolation from one another and being out of the source tree, but that's just my opinion. I don't think you can have "Shadow building" enabled in Creator and have the build folder on a level different from the source.

                                J Offline
                                J Offline
                                jax1157
                                wrote on last edited by
                                #15

                                @kshegunov

                                You definitely used to be able to do it - The warning is only since 4.1.0. I do remember it doing it in 2011 (now that you mention it), but they fixed that up pretty quickly.

                                Just to explain re builds:

                                A shadow looks like this with no builds:

                                • Shadow
                                  • Toplevel1.pro
                                  • Source1
                                  • Source2

                                The choices are:

                                Option A

                                • Shadow
                                  • Toplevel1.pro
                                  • Source1
                                  • Source2
                                  • Build1
                                  • Build2

                                Ugly - Top level of the shadow now has a heap of build directories (1 per config), all of which have to be ignored, and mixed in with the source. Also - This is what Qt Creator seems to want by default.

                                Option B

                                • Build 1
                                • Build 2
                                • Shadow
                                  • Toplevel1.pro
                                  • Source1
                                  • Source2

                                Definitely not! If you have >1 shadow (from different branches of the same source), then the build directories conflict.

                                Option C

                                • Shadow
                                  • Toplevel1.pro
                                  • Source1
                                  • Source2
                                  • Build
                                    • Build1
                                    • Build2

                                What I want. Most common structure I have seen. Can clean source tree completely by removing "build" directory only. No conflicts with other shadows. Used to work - Now doesn't.

                                1 Reply Last reply
                                0
                                • mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by mrjj
                                  #16

                                  Im also starting see these after upgrade.
                                  I did not change project layout and it do not show in version before 4.1.0

                                  So its a new check of sorts?

                                  I have all build folders on ramdrive. since day one. never saw this message before.

                                  kshegunovK F 2 Replies Last reply
                                  1
                                  • mrjjM mrjj

                                    Im also starting see these after upgrade.
                                    I did not change project layout and it do not show in version before 4.1.0

                                    So its a new check of sorts?

                                    I have all build folders on ramdrive. since day one. never saw this message before.

                                    kshegunovK Offline
                                    kshegunovK Offline
                                    kshegunov
                                    Moderators
                                    wrote on last edited by
                                    #17

                                    @mrjj said in The build directory needs to be at the same level as the source directory.:

                                    So its a new check of sorts?

                                    Maybe only on windows. I always had that warning ...

                                    Read and abide by the Qt Code of Conduct

                                    J 1 Reply Last reply
                                    1
                                    • kshegunovK kshegunov

                                      @mrjj said in The build directory needs to be at the same level as the source directory.:

                                      So its a new check of sorts?

                                      Maybe only on windows. I always had that warning ...

                                      J Offline
                                      J Offline
                                      jax1157
                                      wrote on last edited by
                                      #18

                                      @kshegunov On Mac also. The check went away for a few years, but now it is back.

                                      kshegunovK 1 Reply Last reply
                                      0
                                      • J jax1157

                                        @kshegunov On Mac also. The check went away for a few years, but now it is back.

                                        kshegunovK Offline
                                        kshegunovK Offline
                                        kshegunov
                                        Moderators
                                        wrote on last edited by
                                        #19

                                        @jax1157 said in The build directory needs to be at the same level as the source directory.:

                                        On Mac also.

                                        I don't touch that stuff, sorry. I'm not rich enough to buy an overpriced PC.

                                        The check went away for a few years, but now it is back.

                                        The joke aside, I just might be remembering wrong, it happens too often I'm afraid.

                                        Read and abide by the Qt Code of Conduct

                                        1 Reply Last reply
                                        0
                                        • mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          But why does it warn me?
                                          It still works. And its really not on
                                          same level as it's on a separate drive.

                                          J 1 Reply Last reply
                                          1

                                          • Login

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