qt 5.12.8 release build
-
I use qtcreter as IDE , qt version is 5.12.8. when i build my project with qmake in qtcreator .i want to make a release build but after i finish building the project the lib file (.so) or executive file still has debug info ( readelf -S *.so|grep debug show some debug section ) . In XXX.pro file i use CONFIG+=release CONFIG -= debug but the generated files still have debug info . so how to use qmake and make build qt project to generate a release verion .?
-
When compiling and linking your
.so
or executable Creator shows the actual commands being issued (in Build Output pane?). Copy and paste here when you build for release so you & we can see what it is doing. Make sure you are doing so on the.so
/executable built for Release, not one built for Debug. Runfile
on it and see how that describes it, I think (but not sure)file
tells you whether compiled for debug. -
CONFIG -= qt
TEMPLATE = lib
DEFINES += TESTRELEASELIB_LIBRARY
CONFIG += c++11
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES +=
testreleaselib.cpp
HEADERS +=
testreleaselib_global.h
testreleaselib.hDefault rules for deployment.
unix {
target.path = /usr/lib
}
!isEmpty(target.path): INSTALLS += target
TARGET=testreleasesharelib
CONFIG += release
DESTDIR = $$(PUBLISH_DIR)/libs/InnerLib/MissionConfigToolThe OS is linux centos . Same sub project in different position generate diffrent result. one is release version the other contains debug info .
build panel output :
03:05:19: 清除03:05:19: 构建03:05:19: 为项目NEWYTH执行步骤 ...
03:05:19: 正在启动 "/usr/bin/make" clean -j8rm -f .obj/testreleaselib.o
rm -f *~ core *.core
03:05:19: 进程"/usr/bin/make"正常退出。
03:05:19: 正在启动 "/home/kylin/Qt5.12.8/5.12.8/gcc_64/bin/qmake" /workspace/newyth/TaskPrepareTool/designer/src/wlltest/testreleaselib/testreleaselib.pro -spec linux-g++ CONFIG+=qtquickcompiler03:05:19: 进程"/home/kylin/Qt5.12.8/5.12.8/gcc_64/bin/qmake"正常退出。
03:05:19: 正在启动 "/usr/bin/make" -f /workspace/build-NEWYTH-Desktop_Qt_5_12_8_GCC_64bit-Release/TaskPrepareTool/designer/src/wlltest/testreleaselib/Makefile qmake_allmake: 对“qmake_all”无需做任何事。
03:05:19: 进程"/usr/bin/make"正常退出。
03:05:19: 正在启动 "/usr/bin/make" -j8g++ -c -pipe -O2 -g -std=gnu++11 -fno-exceptions -Wall -W -fPIC -DTESTRELEASELIB_LIBRARY -DQT_DEPRECATED_WARNINGS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/workspace/newyth/TaskPrepareTool/designer/src/wlltest/testreleaselib -I. -I/home/qt/openssl-1.1.1d/include -I/home/kylin/Qt5.12.8/5.12.8/gcc_64/mkspecs/linux-g++ -o .obj/testreleaselib.o /workspace/newyth/TaskPrepareTool/designer/src/wlltest/testreleaselib/testreleaselib.cpp
rm -f libchangedirlib.so.1.0.0 libchangedirlib.so libchangedirlib.so.1 libchangedirlib.so.1.0
g++ -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,$ORIGIN/../../home/kylin/Qt5.12.8/5.12.8/gcc_64/lib -shared -Wl,-soname,libchangedirlib.so.1 -o libchangedirlib.so.1.0.0 .obj/testreleaselib.o -L/home/qt/openssl-1.1.1d/lib
ln -s libchangedirlib.so.1.0.0 libchangedirlib.so
ln -s libchangedirlib.so.1.0.0 libchangedirlib.so.1
ln -s libchangedirlib.so.1.0.0 libchangedirlib.so.1.0
rm -f /workspace/newythPublish/libs/InnerLib/MissionConfigTool/libchangedirlib.so.1.0.0
mv -f libchangedirlib.so.1.0.0 /workspace/newythPublish/libs/InnerLib/MissionConfigTool/libchangedirlib.so.1.0.0
rm -f /workspace/newythPublish/libs/InnerLib/MissionConfigTool/libchangedirlib.so
rm -f /workspace/newythPublish/libs/InnerLib/MissionConfigTool/libchangedirlib.so.1
rm -f /workspace/newythPublish/libs/InnerLib/MissionConfigTool/libchangedirlib.so.1.0
mv -f libchangedirlib.so /workspace/newythPublish/libs/InnerLib/MissionConfigTool/libchangedirlib.so
mv -f libchangedirlib.so.1 /workspace/newythPublish/libs/InnerLib/MissionConfigTool/libchangedirlib.so.1
mv -f libchangedirlib.so.1.0 /workspace/newythPublish/libs/InnerLib/MissionConfigTool/libchangedirlib.so.1.0
03:05:20: 进程"/usr/bin/make"正常退出。
03:05:20: Elapsed time: 00:01.file command output
[root@localhost MissionConfigTool]# file libchangedirlib.so.1.0.0
libchangedirlib.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
[root@localhost MissionConfigTool]# readelf -S libchangedirlib.so.1.0.0 |grep debug
[23] .debug_aranges PROGBITS 0000000000000000 00001041
[24] .debug_info PROGBITS 0000000000000000 00001071
[25] .debug_abbrev PROGBITS 0000000000000000 0000117c
[26] .debug_line PROGBITS 0000000000000000 00001263
[27] .debug_str PROGBITS 0000000000000000 00001304
[root@localhost MissionConfigTool]# -
@jjgcwll
I see no evidence anything here is compiled for debug. The fact thatreadelf
shows it has some symbols/areas to do with "debug" does not mean it is compiled for debug, for all I know these areas are empty-ish when compiled for release and full-ish when compiled for debug.Why don't you start by compiling once for release and once for debug and compare
ls -l libchangedirlib.so
? Are they the same size or is the debug version much bigger than the release one?UPDATE
Actually yourg++ -c -pipe -O2 -g ...
, isn't-g
option for generate debug?