can't debug hand-built Qt Frameworks
-
so i got all the Qt frameworks built, and configured my Qt Creator kit to so my project can use them.
but when i break in the debugger, apparently debug symbols aren't loaded, so i can't see the source code:note eg: lines 13 and 14: they are "grayed out" indicating no source code. even though as you can see they are in the "Qt5_Source" directory, which is where i built Qt myself.
i've set "source path mapping" too:
-
Hi,
Might be a silly question but did you do a debug build ?
If memory serves well a pure debug build does not generate frameworks, only libraries. -
to build the qt5 source i did these things:
> ../qt5/configure -prefix ./obj/debug -developer-build -opensource -nomake examples -nomake tests -confirm-license > make
doesn't that mean i built the debug version? if not, how do i build both debug and release?
-
A developer build is an in place build with some special flags. You need to pass the -debug-and-release parameter to configure.
Why are you passing a prefix when doing a developer build ?
-
i was under the impression that if i do NOT pass a prefix that it will leave artifacts in the source directory.
so are you saying that my configure command should be this:
> ../qt5/configure -developer-build -debug-and-release -opensource -nomake examples -nomake tests -confirm-license
should i bother with adding
-developer-build
? does it give me any advantage? if i add-debug-and-release
are the frameworks put in separate directories?please bear with me this is all brand new to me
-
- Do out of source builds. That way you keep your sources clean
- Unless you plan to hack on Qt, no drop the flag
- if you drop the flag, use a suitable prefix
- From memory it will make frameworks with both inside
-
- what does "do out of source builds" mean?
- when you say "hack" do you mean "edit Qt source code"? and if so, then yes, that's the only reason one would want to build from source in the first place, that i can think of. yes i definitely need to edit the source code. to be clear we're talking about the
-developer-build
flag, right? so i should keep it? - i am not dropping the flag, right? so no need to use prefix? where do the files go then?
- are these frameworks, with both debug and release inside, suitable for deploying release apps? i think i wouldn't want my actual release app to have debug frameworks. will "macdeployqt" just "do the right thing" ?
please err on the side of extra verbosity in your replies. remember that things that you feel you've always known, or that everybody knows, or seem very obvious to you, some of these things are simply not even on my radar.
-
- literally what it says: build in a folder outside of the source tree.
- there are various reasons: build Qt with a different set of options, build a reduced version of Qt with features disabled to lower its footprint, etc. So yes you can keep the developer build option
- no do not use the prefix flag. As already said it creates an in-place build so you do not need to call make install after each build.
- no they are not. The developer build also enables some additional flags (sorry I don't have them on the top of my head) that makes the build less optimized than a usual release build. When you release an application use a proper release build for that.
One additional thing: build only what you really need and skip webengine in any case unless you have to.
There's no sense in building everything if you are only going to hack on qtbase. You will just waste time, space and electricity.
-
1: to build in a folder outside of the source tree, doesn't that mean using
-prefix
? or does it just mean set the current working directory to the location you want the build artifacts, and invoke "make" from that location?
2: okay, so keep the-developer-build
option
3: see 1
4: so how do i create this "proper release build" that has the changes i've made to the Qt source? to be clear: i want to create both debug and release builds of Qt, and deploy my app WITH the release builds that i've built
5: does macdeployqt magically do the right thing?
6: by "build only what you really need" do you mean build only the modules that i have specified in my qmake file at the top? eg: if my .pro file has this line:QT += core gui sql widgets multimedia multimediawidgets
does that mean i only need to build those modules?
-
- no, prefix is for the installation of the build result.
Snip
-
make a standard non developer build once you are satisfied with the changes you did with Qt.
-
there's nothing macdeployqt can do beside deploying the frameworks that were used to build your application. It's a helper tool that uses standard commands to create the dmg. So deploying your application with a developer build of Qt is not recommended.
-
with that list you need to build qtbase and qtmultimedia. Note that having only these two will disable the qml support in qtmultimedia.
-
so, to recap, i need to do these commands:
> cd <path_to>/Qt5_Source/build > ../qt5/configure -developer-build -debug-and-release -opensource -nomake examples -nomake tests -confirm-license -feature qtbase -feature qtmultimedia > make > ../qt5/configure -prefix ./release -opensource -nomake examples -nomake tests -confirm-license -feature qtbase -feature qtmultimedia > make > make install
- is that all correct?
- and after that i can build either debug or release version of my app and it should work?
- and i can debug into the source of Qt?
- and when i run macdeployqt, it will use my built version of Qt?
- do i need to specify anything extra on the command line for macdeployqt?
-
- no use two different build folder
- it should
- you should be able to
- yes, note that you may need to build the qttools module or macdeployqt directly from it. But you should be able to use the one from your pre-built installation.
- that depends on how you want to distribute your application. You should sign it and possibly notarize it.
-
- do you mean this:
> cd <path_to>/Qt5_Source/build > ../qt5/configure -prefix ./debug -developer-build -debug-and-release -opensource -nomake examples -nomake tests -confirm-license -feature qtbase -feature qtmultimedia > make > ../qt5/configure -prefix ./release -opensource -nomake examples -nomake tests -confirm-license -feature qtbase -feature qtmultimedia > make
if you don't mean that can you please just spell out exactly what you mean?
4) do you mean this:../qt5/configure -prefix ./release -opensource -nomake examples -nomake tests -confirm-license -feature qtbase -feature qtmultimedia -feature qttools
if not can you spell out what you mean?
5) yes i only have macdeployqt do the linking / signing / hardening. i already have a post process that builds a dmg and notarizes. i was only asking if i need something extra on the macdeployqt command line to get it to use MY copies of the built binaries for Qt -
- I mean: use two different folders for your out of source builds. You do not want it mix the build artifacts of your developer build and your release build.
Snip
- If memory serves well, macdeployqt will use the information from the frameworks linked in your application to get the Qt frameworks to be copied into the app bundle.
-
- do you mean this:
> cd <path_to>/Qt5_Source/build/debug > ../../qt5/configure -developer-build -debug-and-release -opensource -nomake examples -nomake tests -confirm-license -feature qtbase -feature qtmultimedia > make > cd <path_to>/Qt5_Source/build/release > ../../qt5/configure -prefix ./obj -opensource -nomake examples -nomake tests -confirm-license -feature qtbase -feature qtmultimedia > make > make install
- what about 4. above?
-
You should use more meaningful names for your folders. Your developer build is not just a debug build.
Using obj as prefix is really strange considering that this folder is going to contain a full Qt installation.I missed that you used "feature". This a different thing. You do not need it right now. Currently you want to use the "-skip" parameter to avoid building certain qtXXX modules.
-
believe me when i say i very much appreciate your bearing with me and continuing to answer my questions, but it's also true that you're assuming i have a lot of knowledge that you have, that i definitely don't have.
can you please spell out EXACTLY what the command lines should be for me to build both debug and release, and please include what you mean by "more meaningful names" because i do NOT know what you have in mind.
please would you be willing to just type up the command lines that you would use to do what i am trying to do, cuz i do not know what you mean. thanks...
-
perhaps i can be more clear in my question.
- what would you recommend for "meaningful names" ?
- what name would you recommend in place of where i used "obj" ?
- instead of using "feature" to include only the features i want, you suggest using "skip" to skip the features i do not want. how do i get a list of features that can go into "skip", and how do i know which ones i want to include on the "skip" line?
-
pretty please? with <insert favorite indulgence> on top?
-
- use the Qt version in the name of folder. for example Qt_5_15_2_devel_build
- at least the Qt version as above.
- you are mixing modules and features. These are separate concepts. Skip everything you do not want to build.