qt - qmake 不断添加 -s (strip) 来调试构建,如何禁用剥离?
问题描述
使用的 QT 版本:5.12.6
我正在尝试使用调试符号从 QTWebEngine (quicknanobrowser) 构建示例。我一直得到一个没有调试符号的二进制文件,即使明确设置CONFIG+=debug
或CONFIG+=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++
解决方案
https://doc.qt.io/qt-5/qmake-variable-reference.html
nostrip - 如果设置,典型的 Unix 条带功能将关闭,调试信息将保留在二进制文件中。
推荐阅读
- python - 如何使用无类型元素按键对列表进行排序?
- go - 如何修复 GoLang 的 LDAP 过滤器操作错误?
- python - 比较两个恒星 xy 坐标列表以找到匹配的对象
- c++17 - 在 C++17 的不可变类中,如何防御性地检查分配给公共 const 变量的值?
- terraform - 如何最好地处理使用常见 .tf 文件的多个 .tfvars 文件?
- java - {Java} Vaadin 14 - 检测用户离开(关闭选项卡、f5 等)
- sas - 使用do循环连接SAS中的数组
- ruby - Ruby 社区首选的循环类型是什么?
- sql - Oracle SQL 获取每个 id 的最新行
- regex - Google Sheets Query > Filter rows based on text in a string