简体   繁体   English

如何在 Ubuntu 中将 Qt 源添加到 QtCreator?

[英]How to add Qt sources to QtCreator in Ubuntu?

Edit The answers to this post either say compile yourself - which I don't want do to - or install qtbase5-dbg which is not part of Ubuntu releases anymore.编辑这篇文章的答案要么说自己编译 - 我不想这样做 - 要么安装不再属于 Ubuntu 版本的qtbase5-dbg So is there no way to achieve this without this package?那么没有这个包就没有办法做到这一点吗? And shouldn't there be different debug symbols for each Qt 5.X version?每个 Qt 5.X 版本不应该有不同的调试符号吗?


I'm trying to add Qt sources - which I installed along Qt both using the Qt Maintenance tool - to QtCreator but am not able to get it to work.我正在尝试将 Qt 源(我使用 Qt 维护工具沿 Qt 安装)添加到 QtCreator,但无法使其工作。 I've already looked at various websites for help but still no luck.我已经查看了各种网站寻求帮助,但仍然没有运气。 I need to step into the Qt sources to see how Qt3D works since I'm trying to develop a Qt3D widget.由于我正在尝试开发 Qt3D 小部件,因此我需要进入 Qt 源代码以了解 Qt3D 的工作原理。

As for many others, when I go to Options > Debugger and there under Source Path Mappings click on Add Qt sources... it adds /home/qt/work/qt as Source Path and /home/[my username]/Qt/5.14.2/Src (the latter being the folder I selected).至于其他许多人,当我转到 Options > Debugger 并在 Source Path Mappings 下单击Add Qt sources...它添加/home/qt/work/qt作为Source Path/home/[my username]/Qt/5.14.2/Src (后者是我选择的文件夹)。

Since I can't step into the Qt sources I assume the Source Path is wrong.由于我无法进入 Qt 源,我认为Source Path是错误的。 I tried to follow the steps from this answer but when I move the mouse over a function call in the call stack after stopping at a breakpoint doesn't yield any path - just the function name and address.我试图按照这个答案中的步骤进行操作,但是当我在断点处停止后将鼠标移到调用堆栈中的函数调用上时,不会产生任何路径 - 只是函数名称和地址。

Someone also pointed out that the compiled Qt libraries must not include stripped when getting info from them like this: file libQt... .有人还指出,编译后的 Qt 库在从它们获取信息时不能包含stripped ,如下所示: file libQt... But this is what file libQt53DCore.so.5.14.2 gave me:但这是file libQt53DCore.so.5.14.2给我的file libQt53DCore.so.5.14.2

libQt53DCore.so.5.14.2: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=d764882c0c26814e30d63a4d4719143e14e4c735, not stripped

So I assume that's fine.所以我认为这很好。 Although I built Qt myself and file libQt53DCore.so.5.15.0 yields虽然我自己构建了 Qt 并且file libQt53DCore.so.5.15.0产量

 libQt53DCore.so.5.15.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=88eeb269ff68f0b71e3612d1a538503676da3790, with debug_info, not stripped

ie an additional with debug_info .即额外with debug_info

Unfortunately, building Qt results in a 20 something GB build and I would have to do this for multiple Qt versions.不幸的是,构建 Qt 会导致 20 GB 的构建,我必须为多个 Qt 版本执行此操作。 So how can I setup QtCreator properly so that I can step into Qt sources.那么如何正确设置 QtCreator 以便我可以进入 Qt 源代码。

A few minor versions ago, Qt added "Qt debug information files" to the maintenance tool.几个小版本之前,Qt在维护工具中添加了“Qt调试信息文件”。 They contain the debug information of the libraries.它们包含库的调试信息。

Which means, if you debug and want to step into human readable Qt library code you have to install them.这意味着,如果您调试并想要进入人类可读的 Qt 库代码,您必须安装它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM