Re: [Interest] Optimizations in debug configuration

2016-09-24 Thread Konstantin Shegunov
On Sat, Sep 24, 2016 at 9:00 AM, Thiago Macieira 
wrote:

> It probably comes from the environment variables of the machine that built
> the
> package.


Indeed. Using my own Qt build resolves the issue (installed mkspec doesn't
contain the mentioned line either).
Thanks for the assistance!
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-24 Thread Thiago Macieira
On sábado, 24 de setembro de 2016 04:25:05 PDT Konstantin Shegunov wrote:
> Curiously enough, that line isn't present in the Qt's source for the same
> version I have from git. Is it possible it was inserted automatically on
> install, or whatever process is used for packaging the binaries for debian?

It probably comes from the environment variables of the machine that built the 
package.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-23 Thread Konstantin Shegunov
On Sat, Sep 24, 2016 at 3:50 AM, Konstantin Shegunov 
wrote:

> On Sat, Sep 24, 2016 at 3:23 AM, Thiago Macieira <
> thiago.macie...@intel.com> wrote:
>>
>> run qmake with -d -d switches and look for where that "-g -O2" is coming
>> from.
>
>
> The best I can tell it comes from this line:
> QMAKE_CXXFLAGS = -g -O2 -fdebug-prefix-map=/build/qtba
> se-opensource-src-1gAkgj/qtbase-opensource-src-5.6.1+dfsg=.
> -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2
>
> which is located in qmodule.pri (directory is
> /usr/lib/x86_64-linux-gnu/qt5/mkspecs). Which project include is made
> relevant by:
> load(qt_build_config) # loads qmodule.pri if hasn't been loaded already
>
> which I find in qt_module.prf. The latter I load directly in my module's
> project file (at the end).
>

Curiously enough, that line isn't present in the Qt's source for the same
version I have from git. Is it possible it was inserted automatically on
install, or whatever process is used for packaging the binaries for debian?
Or perhaps it was added manually by the maintainer? Very strange.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-23 Thread Konstantin Shegunov
On Sat, Sep 24, 2016 at 3:23 AM, Thiago Macieira 
wrote:
>
> run qmake with -d -d switches and look for where that "-g -O2" is coming
> from.


The best I can tell it comes from this line:
QMAKE_CXXFLAGS = -g -O2 -fdebug-prefix-map=/build/
qtbase-opensource-src-1gAkgj/qtbase-opensource-src-5.6.1+dfsg=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2

which is located in qmodule.pri (directory is
/usr/lib/x86_64-linux-gnu/qt5/mkspecs).
Which project include is made relevant by:
load(qt_build_config) # loads qmodule.pri if hasn't been loaded already

which I find in qt_module.prf. The latter I load directly in my module's
project file (at the end).
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-23 Thread Thiago Macieira
On sábado, 24 de setembro de 2016 00:37:54 PDT Konstantin Shegunov wrote:
> I'm building a module and what I observe is getting -g -O2 for
> CONFIG+=debug. One thing I was able to infer was that
> setting QMAKE_CXXFLAGS to nothing seems to solve it for me. I wouldn't even
> dream of speculating why this is happening, it probably is my own
> configuration, albeit the qt3d module compiles with -g -O2 when I call
> qmake CONFIG+=debug on its root project file.

run qmake with -d -d switches and look for where that "-g -O2" is coming from.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-23 Thread Konstantin Shegunov
On Sat, Sep 24, 2016 at 1:35 AM, Allan Sandfeld Jensen 
wrote:
>
> Maybe it is following Qt's configuration instead of the one you request
> locally.


Yes, that'd be my guess too. What I imagine is happening is that I have -O2
coming from the configure flags Qt was built with (in my case release, as
I'm using my distribution's supplied binaries), and I get -g from calling
qmake with CONFIG+=debug. I'm no qmake guru, just that's the scenario that
sounds most plausible to me.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-23 Thread Allan Sandfeld Jensen
On Friday 23 September 2016, Konstantin Shegunov wrote:
> On Fri, Sep 23, 2016 at 5:31 AM, Thiago Macieira
> 
> 
> wrote:
> > The flag is not passed to the build.
> > 
> > Debug builds use -O0 on Linux.
> 
> I'm building a module and what I observe is getting -g -O2 for
> CONFIG+=debug. One thing I was able to infer was that
> setting QMAKE_CXXFLAGS to nothing seems to solve it for me. I wouldn't even
> dream of speculating why this is happening, it probably is my own
> configuration, albeit the qt3d module compiles with -g -O2 when I call
> qmake CONFIG+=debug on its root project file.

"-O2 -g" is only supposed to be used for release-with-debug-info, not debug. 
Maybe it is following Qt's configuration instead of the one you request 
locally. 

`Allan
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-23 Thread Konstantin Shegunov
On Fri, Sep 23, 2016 at 5:31 AM, Thiago Macieira 
wrote:
>
> The flag is not passed to the build.
>
> Debug builds use -O0 on Linux.
>

I'm building a module and what I observe is getting -g -O2 for
CONFIG+=debug. One thing I was able to infer was that
setting QMAKE_CXXFLAGS to nothing seems to solve it for me. I wouldn't even
dream of speculating why this is happening, it probably is my own
configuration, albeit the qt3d module compiles with -g -O2 when I call
qmake CONFIG+=debug on its root project file.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-22 Thread Thiago Macieira
On sexta-feira, 23 de setembro de 2016 01:52:28 PDT Konstantin Shegunov wrote:
> Hello,
> What's the rationale of having -O2 for debug builds on Linux (g++)? As the
> compiler moves the assembly around it becomes hell stepping through with
> the debugger. Is the flag passed intentionally (and why)?

The flag is not passed to the build.

Debug builds use -O0 on Linux.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-22 Thread Konstantin Shegunov
On Fri, Sep 23, 2016 at 2:19 AM, Giuseppe D'Angelo <
giuseppe.dang...@kdab.com> wrote:
>
> Hope this helps
>

It does, thanks! I wasn't talking about profiling, but your answer pointed
me in the right direction. Apparently I have a sneaky flag somewhere in my
build configuration which shouldn't be there and I have, as you so
eloquently put it, a *hard*, *hard* *time* understanding what the compiler
did to my code... :)

I'll investigate further. Thanks again!
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Optimizations in debug configuration

2016-09-22 Thread Giuseppe D'Angelo
Hi,

Il 23/09/2016 00:52, Konstantin Shegunov ha scritto:
> What's the rationale of having -O2 for debug builds on Linux (g++)? As
> the compiler moves the assembly around it becomes hell stepping through
> with the debugger. Is the flag passed intentionally (and why)?

This kind of builds ("profile" builds, or "release with debug info") is
not usually used to step, rather to be able to profile the application
and still be able to map costs to the correct functions / lines in the
original source. Running profilers on unoptimized binaries is absolutely
pointless.

(Then, sure, you can also step through in a debugger, but you'll have a
*hard*, *hard* *time* understanding what the compiler did to your code...).

Hope this helps,
-- 
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Optimizations in debug configuration

2016-09-22 Thread Konstantin Shegunov
Hello,
What's the rationale of having -O2 for debug builds on Linux (g++)? As the
compiler moves the assembly around it becomes hell stepping through with
the debugger. Is the flag passed intentionally (and why)?

Kind regards.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest