annoying warnings from Qt on the console

Thiago Macieira thiago at macieira.org
Mon Aug 18 15:03:50 PDT 2014


On Monday 18 August 2014 11:34:19 Dirk Hohndel wrote:
> Dear Qt Experts...
> 
> I had seen those on Windows (but no one starts things from the console
> there), and now that I have switched my Linux builds to be Qt5 by default
> as well I get them on Linux and it's rather annoying.
> 
> Simply starting Subsurface without any data file gives me >100
> 
> QFSFileEngine::open: No file name specified
> 
> warnings.
> 
> My guess is that this could be related to my hacked version of Marble
> (that throws away large parts of Marble code), but I wonder how to track
> down WHERE these messages are coming from. I ran things under the debugger
> (but I don't have built Qt5 from source here on Linux) and tracked the
> first few of them down to being caused by Marble trying to set up its
> styles... but without Qt5 source / ability to step through its functions I
> didn't get very far.
> 
> But fundamentally I wonder if there's an easy way to turn the warnings off
> - they seem kinda pointless.

Set QT_FATAL_WARNINGS=1 in your environment. Qt will abort() right after 
printing that warning, so you should be able to track down which QFile::open() 
call was called before setting the name.

If you're not tracking down the first warning, try putting a breakpoint in 
qMessageFormatString or qt_message_output (you should be able to do that even 
without debug symbols, press Tab to complete the argument list). The mangled 
names, if you need them, are 
_Z20qMessageFormatString9QtMsgTypeRK18QMessageLogContextRK7QString and 
_Z17qt_message_output9QtMsgTypeRK18QMessageLogContextRK7QString.

Once you upgrade to Qt 5.4, you can also set

	QT_MESSAGE_PATTERN='%{backtrace}: %{message}'

And it will print the function name(s) of the backtrace of that message. The 
innermost frame won't help because we know it comes from QFSFileEngine::open, 
called by QFile::open. But for reference, you can get the innermost frame in 
Qt 5.3 already:

	QT_MESSAGE_PATTERN='%{appname}: %{file}:%{line}(%{function}): %{message}'

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the subsurface mailing list