Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
4.7.0
-
None
Description
Take this example .pro file:
- dogwalk.pro
TEMPLATE = lib
TARGET = dogwalk
CONFIG += debug_and_release build_all
SOURCES += dogwalk.cpp
CONFIG(debug, debug|release) {
DESTDIR = Debug
} else {
DESTDIR = Release
}
This generates these rules in the separate debug and release makefiles:
- Makefile.Release
Release/$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP)
@$(CHK_DIR_EXISTS) Release/ || $(MKDIR) Release/
-$(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) Release/$(TARGET)
-$(DEL_FILE) Release/$(TARGET0)
-$(DEL_FILE) Release/$(TARGET1)
-$(DEL_FILE) Release/$(TARGET2)
-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) Release/
- Makefile.Debug
Debug/$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP)
@$(CHK_DIR_EXISTS) Debug/ || $(MKDIR) Debug/
-$(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) Debug/$(TARGET)
-$(DEL_FILE) Debug/$(TARGET0)
-$(DEL_FILE) Debug/$(TARGET1)
-$(DEL_FILE) Debug/$(TARGET2)
-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) Debug/
Each rule ends up putting $(TARGET) under Release or Debug directories, as requested. However, at the line `$(LINK) $(LFLAGS) -o $(TARGET) ...' and following ln commands, both of the makefiles are using $(TARGET), $(TARGET0) etc in the current directory as intermediate files.
Therefore, if a `make' is done on the top Makefile with any `-j', the two rules race with each other. Symptoms may include:
- everything works OK
- one of the Debug or Release directories ends up with broken symbolic links
- the Debug directory ends up with the library built in release mode or vice versa
The bug is compounded by the fact that errors in the ln, rm and mv commands are all ignored so the build claims to be successful.
Attachments
Issue Links
- is replaced by
-
QTBUG-39104 copying TARGET to DESTDIR is counterproductive
- Open
- relates to
-
QTBUG-7110 tools are created debug and release versions.
- Closed