Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Linux / Mac qmake bug? Full rebuild required when a source inside a nested static library has been edited
Forum Updated to NodeBB v4.3 + New Features

Linux / Mac qmake bug? Full rebuild required when a source inside a nested static library has been edited

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 2 Posters 2.0k 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on last edited by
    #1

    This bug is there since forever on Linux, and I think I remember times when it hasn't been present on Mac, but I might be wrong. It is certainly present in Qt 5, and I think 4.8.x as well. Windows versions are unaffected.

    Here's what the problem is: suppose I have an application that uses a static library (.a), which is a part of my project (i. e. is built from sources). If I alter any code in the library, and invoke Build -> Build All in Qt creator, it appears as if the new .o file is generated all right, but the library is not re-linked, and neither is the main application. hence, the change I've made in the sources is not reflected in the final binary. I must re-build the library, and static libraries that include it up the chain of dependence, up to the main application or .so binary.

    It seems that there's a problem with how qmake generates GNU makefiles (dependencies not defined, perhaps?). Unfortunately, I have 0 understanding of makefiles. Can someone please look into this and file a bug report if you manage to pinpoint the issue? Fixing this would save thousands hours of worktime across the world - all the time we have to wait while the project is being rebuilt after every minor edit.

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

      Hi,

      Add

      @
      win32 {
      PRE_TARGETDEPS += "$${LIB_PATH}/"$${LIB_NAME}".lib"
      } else {
      PRE_TARGETDEPS += "$${LIB_PATH}/lib"$${LIB_NAME}".a"
      }
      @

      To your pro/pri files and you should be good to go

      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
      • V Offline
        V Offline
        Violet Giraffe
        wrote on last edited by
        #3

        Thanks. I assume I must substitute $${LIB_PATH} and $${LIB_NAME} with specific names? Is it possible to create a loop to iterate over LIBS in a pro file?
        By the way, I have correctly specified all the dependencies in my root .pro file (which has SUBDIRS template and lists all the projects). Qmake has all the information it needs to generate correct make files; why won't it?

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

          You're assuming correctly.

          You have use that in your actual subdir project where you use the library. The main project is just there to allow building the rest

          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
          • V Offline
            V Offline
            Violet Giraffe
            wrote on last edited by
            #5

            But Is there any reason why qmake can't handle dependencies properly by default? It's very redundant having to specify the same twice - first dependencies between projects in the main .pro file, and then library binary dependencies in every subproject. Especially if your project changes its structure every now and then - you have to do the same twice again.

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

              That's rather a question for the interest mailing list

              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

              • Login

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