Details
-
Bug
-
Resolution: Cannot Reproduce
-
P2: Important
-
None
-
5.12.0, 5.12.1, 5.12.2
Description
I have simple console application with qt core,
I used to build a project with qt 5.11 and everything was fine, but when it was over 5.12, the following problem appeared:
I build qt as follows:
./configure -confirm-license -prefix $BASE_DIR/$QT_DIR -release -optimize-size -static -no-opengl -no-openssl -opensource -nomake tests -nomake examples -no-gui -no-widgets -no-dbus -no-accessibility
qt is successfully built, but when I build my application with the static flag, it starts to require dynamic libraries (although this should not be, and everything was fine with qt 5.11) and is not going to happen because of this.
export PATH=$PATH:$BASE_DIR/$QT_DIR
$BASE_DIR/$QT_DIR/bin/qmake -r QMAKE_LFLAGS+="-static -static-libgcc -static-libstdc++" $BASE_DIR/CQtDeployer.pro
Here is the build error:
g++ -static -Wl,-O1 -Wl,--gc-sections -o build/release/cqtdeployer main.o -L/media/D/own/Console-QtDeployer/QuasarAppLib/build/release -lQuasarApp -L/media/D/own/Console-QtDeployer/Deploy/build/release -lDeploy -L/media/D/own/Console-QtDeployer/pe/pe-parser-library/build/release -lpe-parser-library -L/media/D/own/Console-QtDeployer/staticQt/lib -lQt5Core -lm /media/D/own/Console-QtDeployer/staticQt/lib/libqtpcre2.a /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib/x86_64-linux-gnu/libgthread-2.0.so /usr/lib/x86_64-linux-gnu/libglib-2.0.so -lpthread /usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libdl.so' collect2: error: ld returned 1 exit status Makefile:117: recipe for target 'build/release/cqtdeployer' failed make[1]: *** [build/release/cqtdeployer] Error 1 make[1]: выход из каталога «/media/D/own/Console-QtDeployer/CQtDeployer» Makefile:178: recipe for target 'sub-CQtDeployer-make_first-ordered' failed make: *** [sub-CQtDeployer-make_first-ordered] Error 2
This is a qmake bug.
The fact is that I changed the list of libraries necessary for linking in my makefile to
LIBS = $(SUBLIBS) -L/media/D/own/Console-QtDeployer/QuasarAppLib/build/release -lQuasarApp -L/media/D/own/Console-QtDeployer/Deploy/build/release -lDeploy -L/media/D/own/Console-QtDeployer/pe/pe-parser-library/build/release -lpe-parser-library -L/media/D/own/Console-QtDeployer/staticQt/lib -lQt5Core -lm /media/D/own/Console-QtDeployer/staticQt/lib/libqtpcre2.a -ldl -lglib-2.0 -lpthread
and it all worked, I got the right binary.
before editing was:
CC = gcc
CXX = g++
DEFINES = -DWITHOUT_BASE_TESTS -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CORE_LIB
CFLAGS = -pipe -O2 -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe -O2 -std=gnu++1y -Wall -W -ffunction-sections -fdata-sections -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I. -I../QuasarAppLib -I../Deploy -I../pe/pe-parser-library/include -I../staticQt/include -I../staticQt/include/QtCore -I. -I../staticQt/mkspecs/linux-g++
QMAKE = /media/D/own/Console-QtDeployer/staticQt/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
QINSTALL = /media/D/own/Console-QtDeployer/staticQt/bin/qmake -install qinstall
QINSTALL_PROGRAM = /media/D/own/Console-QtDeployer/staticQt/bin/qmake -install qinstall -exe
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = cqtdeployer1.0.0
DISTDIR = /media/D/own/Console-QtDeployer/CQtDeployer/.tmp/cqtdeployer1.0.0
LINK = g++
LFLAGS = static -static-libgcc -static-libstdc++ -Wl,-O1 -Wl,-gc-sections
LIBS = $(SUBLIBS) -L/media/D/own/Console-QtDeployer/QuasarAppLib/build/release -lQuasarApp -L/media/D/own/Console-QtDeployer/Deploy/build/release -lDeploy -L/media/D/own/Console-QtDeployer/pe/pe-parser-library/build/release -lpe-parser-library -L/media/D/own/Console-QtDeployer/staticQt/lib -lQt5Core -lm /media/D/own/Console-QtDeployer/staticQt/lib/libqtpcre2.a /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib/x86_64-linux-gnu/libgthread-2.0.so /usr/lib/x86_64-linux-gnu/libglib-2.0.so -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip