>>

Qt / KDE Controlling Debug Messages

5 Jan 2023

Here you can find some simple notes on how to debug Qt / KDE applications. My focus is on OpenBSD as host system but everything here should work on GNU/Linux.

kDebug() and friends have been deprecated in KDE Frameworks 5 so you have to use the recommended logging functions qCDebug(category), qCInfo(category), qCWarning(category) qCCritical(category) to create logs from Qt5/Qt6 applications. Since Qt 5.2 QLoggingCategory is available to configure the category and allows us to control the output.

We can control it as follows and this is also the sequence as they are evaluated.

  • [QLibraryInfo::DataPath]/qtlogging.ini
  • QtProject/qtlogging.ini
  • setFilterRules()
  • QT_LOGGING_CONF
  • QT_LOGGING_RULES

In my default setup I disabled all debug logging in ~/.config/QtProject/qtlogging.ini by a simple rule like this:

[Rules]
*.debug=false

and enable step by step by QT_LOGGING_RULES what I want to see. For example, debug KDE Frameworks export QT_LOGGING_RULES="kf.*.debug=true"

QT_FORCE_STDERR_LOGGING is a other useful environment variable to help you to debug from terminal. This ensure all your logs are going to stderr instead syslog or journald. export QT_FORCE_STDERR_LOGGING=1

A common case is to see default debug messeages without a category like: qDeug() << "Simple deug log message". This is possible due to the simple logging rule QT_LOGGING_RULES="default.debug=true".

The pattern is always the same. Search for Q_DECLARE_LOGGING_CATEGORY to identify the log name and filter it with QT_LOGGING_RULES

Here you can find example: codesearch.debian.net - Q_DECLARE_LOGGING_CATEGORY

You can set the QT_LOGGING_DEBUG environment variable to find out where your logging rules are loaded from.

For more informations checkout QLoggingCategory docs.

OpenBSD KDE status 2020

20 May 2020

This short blog post should summarize the KDE/Qt work done in OpenBSD 6.7 and my plans for 6.8.

6.7

The most important achievement was the Qt5 update from 5.9 to 5.13.2. Furthermore, I am very happy that many KDE Applications have made it into the new release. Currently we count 143 KDE5 applications and all KDE Frameworks addon libraries (except Wayland).

The KDE applications are available in version 19.12 and the framework in 5.68.0. In addition, there are some heavyweights in the ports tree:

… and many more exciting KDE/Qt applications.

After the ports-lock

Shortly after the release I committed and announced that I had managed to port the QtWebEngine. All parts are now in the tree and wait until they are unleashed.

It will allow us to port many new applications and give us the opportunity to update a few things. espie@ and tracey@ unbreak kdenlive, which means we have finally a video editor back in OpenBSD.

Next?

As an independent person it is always difficult to plan in the open source environment . Let’s say it like this, I have the following goals for 6.8:

  • Finally enable qtwebengine (easy).
  • Porting the remaining KDE Applications (x11/kde-applications). This is mostly the PIM stuff: Kontact, KMail, KAddressBook KOrganizer https://kontact.kde.org.
  • Get rid of KDE4 (x11/kde4). The conflicts are annoying and nobody uses this stuff anymore. Prove me wrong!

As you can imagine, working on such a large number of ports is very time consuming. I am happy about any feedback and of course about any kind of support.


How to build Qt5 applications with CMake on OpenBSD

29 Mar 2020

If you want to develop a Qt application like me on OpenBSD, you may face the same issue. CMake can’t find the Qt modules.

$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ~/src/happy-qt-hacking
-- The C compiler identification is Clang 8.0.1
-- The CXX compiler identification is Clang 8.0.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5" with any of
  the following names:

    Qt5Config.cmake
    qt5-config.cmake

  Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
  to a directory containing one of the above files.  If "Qt5" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
See also "/home/rsadowski/build-happy-qt-hacking/CMakeFiles/CMakeOutput.log".

This is simply because OpenBSD does not install the Qt5-CMake modules in /usr/local/lib/cmake/ but in /usr/local/lib/qt5/cmake.

In order for find_package to be successful, Qt 5 must be found below the CMAKE_PREFIX_PATH, or the Qt5_DIR must be set in the CMake cache to the location of the Qt5Config.cmake file.

Qt CMake manual

The easiest way to use fix the issue is to set Qt5_DIR

Qt5_DIR=/usr/local/lib/qt5/cmake cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ~/src/happy-qt-hacking