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

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Fri Sep 14 08:06:23 CEST 2012


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simplelib.tar.gz
Type: application/x-gzip
Size: 785 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120914/b3a3da73/attachment.bin>


More information about the Interest mailing list