首页 > 解决方案 > qmake 不断添加 -s (strip) 来调试构建,如何禁用剥离?

问题描述

使用的 QT 版本:5.12.6

我正在尝试使用调试符号从 QTWebEngine (quicknanobrowser) 构建示例。我一直得到一个没有调试符号的二进制文件,即使明确设置CONFIG+=debugCONFIG+=debug nostrip.

经过多次故障排除后,我注意到生成的 Makefile 确实具有-g启用符号的标志,但它也具有-s剥离它们的标志。但是,我似乎无法找到为什么要添加此-s标志。

。轮廓:

requires(qtConfig(accessibility))

TEMPLATE = app
TARGET = quicknanobrowser

HEADERS = utils.h
SOURCES = main.cpp
CONFIG+= debug

OTHER_FILES += ApplicationRoot.qml \
               BrowserDialog.qml \
               BrowserWindow.qml \
               DownloadView.qml \
               FullScreenNotification.qml

RESOURCES += resources.qrc

QT += qml quick webengine

qtHaveModule(widgets) {
    QT += widgets # QApplication is required to get native styling with QtQuickControls
}

target.path = $$[QT_INSTALL_EXAMPLES]/webengine/quicknanobrowser
INSTALLS += target

生成的 Makefile 片段:

LFLAGS        = -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$$ORIGIN/../../../../5.12.6/gcc_64/lib -Wl,-rpath,\$$ORIGIN/../../../../5.12.6/gcc_64/lib -Wl,-rpath-link,/home/amol/code/QTJimber/qtwebengine/lib -Wl,-rpath-link,/home/amol/Qt/5.12.6/gcc_64/lib -s

如果我从 Makefile 中手动删除-s标志,我可以获得带有符号的二进制文件,但这似乎不是有意的..

编辑
添加message(CONFIG: $$CONFIG) message(QMAKE_LFLAGS: $$QMAKE_LFLAGS) message(QMAKE_LFLAGS_DEBUG: $$QMAKE_LFLAGS_DEBUG) message(QMAKE_LFLAGS_RELEASE: $$QMAKE_LFLAGS_RELEASE) message(QMAKESPEC: $$QMAKESPEC)到 .pro 文件的输出:

Project MESSAGE: CONFIG: lex yacc debug exceptions depend_includepath testcase_targets import_plugins import_qpa_plugin qt_build_extra file_copies qmake_use qt warn_on release link_prl incremental shared release linux unix posix gcc sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c force_debug_info largefile precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions explicitlib warning_clean debug
Project MESSAGE: QMAKE_LFLAGS:
Project MESSAGE: QMAKE_LFLAGS_DEBUG:
Project MESSAGE: QMAKE_LFLAGS_RELEASE: -Wl,-O1
Project MESSAGE: QMAKESPEC: /home/amol/Qt/5.12.6/gcc_64/mkspecs/linux-g++

标签: qtqmakeqt5.12

解决方案


https://doc.qt.io/qt-5/qmake-variable-reference.html

nostrip - 如果设置,典型的 Unix 条带功能将关闭,调试信息将保留在二进制文件中。


推荐阅读