Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.0
-
None
Description
qmake may generate Makefile with redundant linker information. In one case, the following linker line was produced:
g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.3.0/lib -o bin/daemon_gpib
obj/BuildInfo.o obj/CommandHandler.o obj/main.o
-L/usr/local/Trolltech/Qt-4.3.0/lib -L../../gen/lib
-L/usr/local/Trolltech/Qt-4.3.0/lib -L/usr/lib -pthread -pthread
-pthread -pthread -pthread -pthread -pthread -pthread -L/usr/X11R6/lib
-pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread
-pthread -pthread -L../../trans/lib -ltrans -L../../libs -lgen -lQtSql
-pthread -pthread -lmysqlclient_r -lcrypt -lnsl -pthread -pthread
-pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread
-pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread
-pthread -pthread -pthread -pthread -lQtXml -pthread -pthread -lQtGui
-lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lXfixes
-lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtNetwork
-lssl -lcrypto -pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0
-lglib-2.0 -lrt -ldl -lpthread
The consecutive occurrences of "-pthread" clutters the linker line and is unnecessary, and qmake should remove the redundant linker information. Although the above is an extreme case, the below linker line (with one redundant "-pthread" occurrence) was produced when building one of the Qt examples:
g++ -Wl,-rpath,/home/sthomassen/dev/qt-x11-4.3.0-debug/lib -Wl,-rpath,/home/sthomassen/dev/qt-x11-4.3.0-debug/lib
-o wiggly .obj/debug-shared/wigglywidget.o .obj/debug-shared/dialog.o .obj/debug-shared/main.o
.obj/debug-shared/moc_wigglywidget.o .obj/debug-shared/moc_dialog.o -L/home/sthomassen/dev/qt-x11-4.3.0-debug/lib -lQtGui
-L/home/sthomassen/dev/qt-x11-4.3.0-debug/lib -L/usr/X11R6/lib -lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lXfixes
-lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
[...]