Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QMake generating makefiles with relative paths that are too long on Windows
Tyrannic last edited by Tyrannic
Hello, I'm having several problems with qmake on Windows relating to relative paths.
Our project uses several subdir templates throughout our build tree for the source code along with a few internal libraries. We tracked the problem down to Windows having a limitation on relative paths. When qmake (or cmake) generates the make files by default, all of the paths are relative. If that path gets too long (I believe the limit is ~260 characters) qmake/make will fail to resolve the relative path through the Windows API and go into undefined behavior.
We've been unable to solve the issue for months without just moving our build tree to the root of our drives to shorten the paths, but now with some extra classes with rather long names, that solution no longer works. I've tried to put the QMAKE_PROJECT_DEPTH = 0 setting in our root subdirs template .pro file with no luck. I also tried setting that variable in all of the .pro files within our build tree and it had no change on the paths that Qmake generates.
Behavior from this problem, depending on which program encounters the longest path first, is either qmake getting stuck in an infinite loop or make not being able to find a source file even though it most definitely is there. We've "solved" this problem several times throughout our app's development by moving our build tree closer to the root directory on our harddisks, but now months later the bandaide no longer works after a fresh batch of classes with extra long names.
Our build tree is roughly (the names were changed, but it's the exact same layout) as follows:
root.pro ├───projectcode │ ├───projectcode.pro │ └───header & source files ├───corelib │ ├───code │ │ ├───code.pro │ │ └───header & source files │ └───tests │ ├───tests.pro │ ├───UnitTest1Project │ └───UnitTest2Project └───projecttests ├───projecttests.pro ├───UnitTest1Project └───UnitTest2Project
I've looked at this issue: https://forum.qt.io/topic/38990/solved-qmake-infinite-loop
Our issue is not time related
I've also looked at this issue: https://forum.qt.io/topic/51402/solved-qmake-stuck-in-infinite-loop/3
Building directly from the command line via MSYS doesn't work
I've also looked at many many others posts both on here and on StackOverflow related to this issue.
Needless to say, we've not been able to find a solution to this other than not building on Windows. Taking our project to Linux works fine with absolutely no issue, but we have certain dependencies that will not let us fully switch to strictly Linux development.
Thank you to anyone who could shine any light on this.
What exact errors are you getting ?
Include related ?
Link related ?
Tyrannic last edited by
Either Qmake gets stuck in an infinite loop while running, or while making the project, make cannot find the source files.
It's definitely relative path length related, because shortening names works, shortening folder names works, moving the build tree closer to C:\ works. We tried the latter "solution" for a few months, and it worked for a while. However, class names/file names got a bit longer over time and we've bumped over that limit again and we're forced now to look for an actual solution rather than a bandaide.
Out of curiosity, how many levels of sub-projects do you have ?
Fred_Davis Banned last edited by
This post is deleted!