[Interest] Likely qmake bug: Recursion in generated Makefile while building static library

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Mon Sep 24 10:42:23 CEST 2012


> Don't call 'make install' from inside your makefile on your makefile.
> Call it explicitly from the outside. No QMAKE_POST_LINK and
>
> $ qmake && make install
>
> yield the desired result.

My project has a couple of libraries which are built in order of their
deps. If libB required libA, then libB's pro file would look for the
includes and the lib's shared obj in a 'install dir'. So when the
project is built, it would build libA and then 'install' it at a
common 'install dir' location. This location is what was used by other
dependant libs to link to this lib and is set in their respective pro
files. This is why I had kept an 'auto-install' rule as running 'make
install' for each lib from the parent 'pro' was not possible (the
parent pro file uses the SUBDIRS template).

But I guess this was the wrong thing to do. Instead of a common
'install' location, I should probably have a common 'build' location
where all the lib headers and SO's are put. This will avoid the need
to run 'make install' for each lib.

How does Qt's build system manage this? If QtGui depends on QtCore,
does it look for it in the shadow build dir or in the install dir?

>
> Besides the above, it can be considered bad practice to _always_ install.

Why so?

>>     -$(DEL_FILE) build/$(TARGET2)
>>     -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) build/
>>     make install  < --------------------- correctly done as the last step
>
> Maybe it's just pure luck that you don't encounter the problem with
> your shared libs. If this really is the issue, as soon as qmake
> decides something needs to be done after the POST_LINK hook, you'll be
> having the same problem.
>

Yeah. I guess this is what set the wrong expectation for me! :) I
(wrongly) thought post link would be the last step.

Thanks,
-mandeep

>
>> The pro file is pretty simple so this looks like a qmake bug to me.
>
> Probably not. I'd drop the automatic install step and add it to the
> actual build command.
>
> Hope this helps,
> Frans



More information about the Interest mailing list