Page MenuHomeSolus

Qt Creator unable to display any console output (i.e. with qDebug())
Open, LowPublic

Description

It seems like qDebug and other console-writes don't output anything to the application output-pane. It builds fine and starts the application, debugger etc works fine. To recreate it just create an empty console project and add some debug output.

When I run the compiled program from a terminal it outputs it as expected in the terminal.

Am I missing a package or something?

Event Timeline

Does this still happen with the new version?

Also providing an example for me to reproduce it would be great, cause if I need to write any form of Qt/C++, it will be quite some time before I can even look at this.

JoshStrobl edited projects, added Software; removed Lacks Project.Oct 26 2017, 1:42 AM
alekzanther edited projects, added Lacks Project; removed Software.Nov 4 2017, 10:50 AM

I've updated all packages, the issue persists. Here's a screenshot of the issue: https://imgur.com/a/lQ54H

Here's the test project: https://github.com/Alekzanther/HelloSolus

Or more directly, the zip-file of the source code: https://github.com/Alekzanther/HelloSolus/archive/master.zip

alekzanther edited projects, added Software; removed Lacks Project.Nov 4 2017, 12:19 PM

Ok, from having a look at this, it's trying to run the program via terminal (it is a console app by definition). By default, it didn't do anything. When I set the terminal in the options to konsole (which I have installed) and hit run, it runs in konsole and outputs "Hello Solus!" as expected in konsole (but not in the application output tab).

Perhaps it is different for a GUI app

Same here on Budgie desktop. With the default setting of x-terminal-emulator nothing happens when running a console application. However, changing the terminal (Tools > Options > Environment > System) by selecting gnome-terminal instead of x-terminal-emulator, the console application runs in a terminal (not in the application output tab). I don't know why x-terminal-emulator doesn't work as it's a link to gnome-terminal.

Yeah on other distros I have no issues with outputting to the output tab. It helps to have that feature when developing applications, no matter if they are GUI or non-GUI apps. I'll manage for the moment with workarounds and other distros. But it seems, like @MichaelD7 points out, that there's something broken in the gnome-terminal/IDE link which might cause other issues as well if not fixed?

Maybe I could try installing the QtCreator tarball directly from their website...

I'll try it out as well and see what the differences are. The issue with any assumptions on terminals is that you need to have them installed (which is only the case for 2 of the Solus additions and assuming you haven't uninstalled gnome-terminal).

There's also been changes in default qt logging policies over time. This should ensure it would output debug information

QT_LOGGING_RULES=*.debug=true qt-creator

I've done some testing with Qt Creator 4.5.0 installed using the Qt Online Installer for Linux, downloaded from the Qt web site. I also used this installer to install different versions of Qt into my home directory.
With both Qt Creator 4.5.0 and the version in the Solus repo (4.4.1), if I select either of the desktop qt versions (e.g. 5.9.2, 5.9.3, 5.10.0) from my home directory as the kit to use, I can display the qDebug output to the application output window by:

projects mode > run > and uncheck run in terminal

If I use the desktop kit installed from the repo, no output is displayed in the application output window with both Qt Creator 4.5.0 and 4.4.1.

Running in a terminal requires changing to gnome-terminal (with the -- option) in version 4.5.0 as well. This may be because the x-terminal-emulator option links to gnome-terminal with the -e option, which is deprecated.

K4rlos added a subscriber: K4rlos.Aug 5 2018, 2:23 PM
DataDrake triaged this task as Low priority.Oct 16 2018, 4:58 PM

I don't know if it's anyhow useful but qDebug() writes to journalctl. Should it?

Writing stderr to journalctl is what it should do as a non-terminal GUI app. However, I agree with @MichaelD7 that this likely has to do with gnome-terminal not supporting the -e option flag.

I've found a solution to this issue of output not displaying in the application output tab here:
https://bugreports.qt.io/browse/QTBUG-66153

Adding the following environment variable

QT_ASSUME_STDERR_HAS_CONSOLE=1

to the project or to a kit works for both budgie (gnome terminal, which doesn't have the -e flag anymore) and KDE Plasma (konsole).
I don't know if this is relevant, but one of the later posts in the above link states:

"Creator should ideally set QT_ASSUME_STDERR_HAS_CONSOLE=1 now, see stderrHasConsoleAttached() in qlogging.cpp"

ermo raised the priority of this task from Low to Unbreak Now!.May 9 2019, 3:58 AM
ermo moved this task from Backlog to System and Configuration Fixes on the Software board.
ermo lowered the priority of this task from Unbreak Now! to Low.May 9 2019, 4:01 AM

It works for me here:


Using Qt Creator 4.13.2. Note that by default, the project is run in a Konsole window. To output into the "Application Output" panel, go to Projects -> Run and untick the "Run in terminal" checkbox.