Linux / Mac qmake bug? Full rebuild required when a source inside a nested static library has been edited
-
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.
-
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
-
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? -
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
-
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.
-
That's rather a question for the interest mailing list