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

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Mon Sep 24 09:49:04 CEST 2012


Anyone got a chance to try the sample project which illustrates the issue?

It'll be great if someone with Qt5 beta installed can give it a quick
spin. You just need to extract the contents of the archive and run
'qmake && make' in the project dir.

Thanks for your time.

Regards,
-mandeep



On Fri, Sep 14, 2012 at 11:36 AM, Mandeep Sandhu
<mandeepsandhu.chd at gmail.com> wrote:
> Hi All,
>
> I've recently stumbled upon a problem where building a static lib,
> with a QMAKE_POST_LINK step of "make install" results in recursion!
>
> I'm attaching a small example which illustrates the problem. I've
> tried this with Qt 4.8.1. Can anyone try this simple example on
> his/her setup and confirm if the problem exists there too (I haven't
> tried with Qt 5)? To replicate the issue just run 'qmake' and then
> 'make' in the project and you should see the build getting stuck in
> the 'make install' step.
>
> The  QMAKE_POST_LINK step is included so that the lib is automatically
> installed post building and a user need not give an explicit 'make
> install'.
>
> The problem _only_ happens if I try to build a static lib. The _same_
> pro file will work when building a shared lib.
>
> The problem lies in the below snippet of the Makefile:
>
> build/$(TARGET):  $(OBJECTS) $(OBJCOMP)
>     @$(CHK_DIR_EXISTS) build/ || $(MKDIR) build/
>     -$(DEL_FILE) $(TARGET)
>     $(AR) $(TARGET) $(OBJECTS)
>     make install <------------------ Wrong. This step should be the
> last cmd for this target (this is causing the recursion)
>     -$(DEL_FILE) build/$(TARGET)
>     -$(MOVE) $(TARGET) build/
>
>
> Whereas the same build rule when making a shared lib looks proper (the
> make install step is the LAST step):
>
> build/$(TARGET):  $(OBJECTS) $(SUBLIBS) $(OBJCOMP)
>     @$(CHK_DIR_EXISTS) build/ || $(MKDIR) build/
>     -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
>     $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)
>     -ln -s $(TARGET) $(TARGET0)
>     -ln -s $(TARGET) $(TARGET1)
>     -ln -s $(TARGET) $(TARGET2)
>     -$(DEL_FILE) build/$(TARGET)
>     -$(DEL_FILE) build/$(TARGET0)
>     -$(DEL_FILE) build/$(TARGET1)
>     -$(DEL_FILE) build/$(TARGET2)
>     -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) build/
>     make install  < --------------------- correctly done as the last step
>
> The pro file is pretty simple so this looks like a qmake bug to me.
> But I'd like a confirmation once from others here too. I'll file a bug
> report then
>
> Thanks for your time.
>
> Regards,
> -mandeep



More information about the Interest mailing list