I have read in the Qt docs that:
The Qt library contains hundreds of internal checks that will print warning messages when a programming error is detected. We therefore recommend that you use a debug version of Qt when developing Qt-based software.
So I want to link a "debug version of Qt" when compiling PDF4QT.
It uses CMake with vcpkg as package manager when configuring its build.
How can I do that?
I have tried appending -DCMAKE_BUILD_TYPE=Debug
to the config line, but after using ldd
on the generated binary I found out that the Release version of the Qt library is still used.
[EDIT] Here are the exact commands I issued:
cmake -B build_debug -S . -DPDF4QT_INSTALL_QT_DEPENDENCIES=0 -DCMAKE_TOOLCHAIN_FILE=$VCPKG_PATH/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX='/' -DCMAKE_BUILD_TYPE=Debug
cmake --build build_debug --config Debug -j12
Then after compiling if I do for example ldd ./build_debug/Pdf4QtViewerLite/Pdf4QtViewerLite
I get for example:
libQt6Widgets.so.6 => /usr/lib/libQt6Widgets.so.6
so it's still linked to the release build
In the case of PDF4QT
the vcpkg manifest does not specify Qt6
via the port qtbase
as a dependency. As such vcpkg is not going to install Qt6
automatically and cmake will instead find the system installed Qt6. Since the system intalled Qt6 does not come with debug versions of the libraries it is not possible to linke against debug versions of the library.
However, if the manifest includes Qt6
via qtbase
(+ other required qt ports) it will be build by vcpkg and picked up by cmake. In that case -DCMAKE_BUILD_TYPE=Debug
will be enough to select the debug version of the Qt6 libraries.