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. QMake generating makefiles with relative paths that are too long on Windows
Forum Updated to NodeBB v4.3 + New Features

QMake generating makefiles with relative paths that are too long on Windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.1k 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.
  • T Offline
    T Offline
    Tyrannic
    wrote on last edited by Tyrannic
    #1

    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.

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

      Hi,

      What exact errors are you getting ?
      Include related ?
      Link related ?

      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
      • T Offline
        T Offline
        Tyrannic
        wrote on last edited by
        #3

        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.

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

          Out of curiosity, how many levels of sub-projects do you have ?

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

            F Offline
            F Offline
            Fred_Davis
            Banned
            wrote on last edited by
            #5
            This post is deleted!
            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 Extensions
            • Unsolved