Results 1 to 9 of 9

Thread: qwtRenderBackground defined twice, breaks unity build

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qwtRenderBackground defined twice, breaks unity build

    Quote Originally Posted by alex_sh View Post
    While it may look like a lot of work, it's actually a lot easier than it looks, just follow some simple rules, and the compiler always says if something is wrong. I was able to create a full unity build of a project (~1400 files, ~250K loc) in just a couple of hours, including setting it all up.
    The point is that you are doing it with code that is not written with the intention of being concatenated - breaking the scope of the declarations that were intended by the developer ( who knows the code ). And in the end the build times are worse, than what you get from installing Qwt as a library ( because you only have to build it only once - when you install it ).

    I know that some projects maintain Qwt in the way you do it. The reasons I heard so far are:


    1. private patches
    2. being unable to cope with installing and using libraries in general
    3. auto updating to SVN


    Unfortunately 2 is the main motivation, but what is yours and why do you handle the Qwt source code different as the source code of a Qt module ?

    Uwe

  2. #2
    Join Date
    Sep 2010
    Posts
    46
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qwtRenderBackground defined twice, breaks unity build

    Quote Originally Posted by Uwe View Post
    The point is that you are doing it with code that is not written with the intention of being concatenated - breaking the scope of the declarations that were intended by the developer ( who knows the code ). And in the end the build times are worse, than what you get from installing Qwt as a library ( because you only have to build it only once - when you install it ).
    The reasons - well, we have several compilers on several platforms and architectures, so it's a lot easier to just compile it with the rest of the project and not maintain it separately. It's also *a lot* easier to update Qwt from SVN - no need to compile and perform installations on all development computers and in all environments simultaneously. We don't usually have any private patches except for very rare and small fixes that I usually report here.

    The build time increase - well, it takes 4 seconds to build Qwt as a shared library on my machine (7 seconds without unity), so it's no big deal, really. And for incremental builds it's already there. Note that I'm not saying Qwt *must* be built in a unity way, definitely not, I'm saying the method is something the developers should try for their own projects - it definitely has benefited us.

    Breaking the scope - sure, but I don't see how that would actually break the behavior. If there are name clashes, the compiler reports them and we fix them.

    I know that some projects maintain Qwt in the way you do it. The reasons I heard so far are:
    1. private patches
    2. being unable to cope with installing and using libraries in general
    3. auto updating to SVN


    Unfortunately 2 is the main motivation, but what is yours and why do you handle the Qwt source code different as the source code of a Qt module ?
    I guess all three, for the reasons I mentioned above.

    We rarely upgrade Qt, but since we usually depend on the SVN features of Qwt, we update it quite frequently. And, since the SVN version is not quite API/ABI-stable, it would mean that we have to update all the environments simultaneously, which is simply too much work for not much gain. Also, we don't build the widgets part and that reduces the compilation time and the generated library size.

    Cheers,
    Alexander

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qwtRenderBackground defined twice, breaks unity build

    Quote Originally Posted by alex_sh View Post
    The build time increase - well, it takes 4 seconds to build Qwt as a shared library on my machine (7 seconds without unity), so it's no big deal, really.
    What a rocket - on my system it takes several minutes to build the Qwt library from scratch.

    Also, we don't build the widgets part and that reduces the compilation time and the generated library size.
    For regular builds disabling "QWT_CONFIG += QwtWidgets" in qwtconfig.pri does this.

    Anyway I don't promise anything, but at least now I have this scenario in mind. Also using the same name for different functions ( even if static to specific files ) is an accident - nothing I would call good practice. Guess most IDEs ( if I would use one ) would have problems with such a thing.

    Uwe

    PS: in trunk the 2 qwtRenderBackground functions have been moved to QwtPainter::drawBackground

  4. #4
    Join Date
    Sep 2010
    Posts
    46
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qwtRenderBackground defined twice, breaks unity build

    Quote Originally Posted by Uwe View Post
    What a rocket - on my system it takes several minutes to build the Qwt library from scratch.
    That's an i7-2600 (4 cores, 8 HT-threads), a debug build with gcc on x86-64 linux. The optimized build takes about twice that time.

    I just did a quick benchmark:
    make -j1: 34 sec.
    make -j1 + unity: 7 sec.
    make -j9: 8.3 sec.
    make -j9 + unity: 4 sec.

    (Note: -j9 seems to be the optimal value for this CPU).
    The less cores/HT-threads you have, the more the speed benefit of a unity build. On an infinite-core machine I guess the ordinary build would approach the unity one, but until then...

    Anyway I don't promise anything, but at least now I have this scenario in mind. Also using the same name for different functions ( even if static to specific files ) is an accident - nothing I would call good practice. Guess most IDEs ( if I would use one ) would have problems with such a thing.
    Good enough for me!

    PS: in trunk the 2 qwtRenderBackground functions have been moved to QwtPainter::drawBackground
    Thanks, I just saw that in SVN.

    Take care,
    Alexander

Similar Threads

  1. Replies: 0
    Last Post: 10th July 2012, 09:36
  2. Replies: 1
    Last Post: 17th May 2011, 16:12
  3. Ubuntu Unity - GOODBYE SYSTEM TRAY
    By genjix in forum General Programming
    Replies: 1
    Last Post: 13th May 2011, 07:51
  4. Ubuntu Unity native menu bar
    By liversedge in forum Qt Programming
    Replies: 1
    Last Post: 8th May 2011, 23:18
  5. DEBUG macro not defined in debug build using vc++
    By piotr.dobrogost in forum Qt Programming
    Replies: 0
    Last Post: 21st July 2009, 13:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.