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



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


  • Qt Champions 2016

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



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


  • Qt Champions 2016

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


  • Lifetime Qt Champion

    Hi,

    What version of Qt ? Qt Creator ? OS ?



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


  • Moderators

    @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.



  • @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...



  • 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

  • Lifetime Qt Champion

    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.



  • @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.


  • Qt Champions 2016

    @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

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



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


  • Qt Champions 2016

    @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.



  • @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:

    The choices are:

    Option A

    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

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

    Option C

    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.


  • Qt Champions 2016

    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.


  • Qt Champions 2016

    @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 ...



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


  • Qt Champions 2016

    @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.


  • Qt Champions 2016

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



  • @mrjj Yes agree - It does still work. It is mainly just annoying, because it is such a non-error. Nothing bad happens as a result.



  • Good to see that others have the same observation and I agree with option C in @jax1157 post as the preferred one over options A and B (and exactly the one I have as well). And indeed, despite the warning for the combination of versions mentioned, it works on Linux, Mac OS and Windows. I just don't like warnings too much if there is no real problem ;)



  • sigh Looks like it is a QMake issue and they perhaps aren't planning to fix it!!

    https://bugreports.qt.io/browse/QTCREATORBUG-16945


  • Qt Champions 2016

    Well I dont think the qmake guru should be the decision maker for Creator..
    as its will soon become a pointless warning
    and if some day you -do- have a project that suffer bad issues from location of build folder,
    you will not think of this warning anymore.

    Its a classic Cry wolf. Or will become.
    https://en.wikipedia.org/wiki/The_Boy_Who_Cried_Wolf

    Its not a big issue for me , but it's a bit annoying as i do like that projects have zero
    warning.

    So Ill go vote for them to make it possible to disable it.



  • Yes, this is a bit annoying, especially when it complains for this structure:

    .../builds/
            project1_build_Release/
            project1_build_Debug/   etc.
    .../projectsrc/
            project1.pro   etc.
    

    This doesn't make any sense.

    It should really warn about build directory being inside the source directory, and nothing else. Even then it should say "is recommended" or something like that, not "needs to be" because it doesn't need to be. And why it should be at the same level?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.