Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED] Using Clang with QtCreator, very slow builds.
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Using Clang with QtCreator, very slow builds.

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 2 Posters 6.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goblincoding
    wrote on 27 Sept 2013, 06:11 last edited by
    #1

    Hi everyone,

    I have recently ported a small application of mine to C++11 (and with that I mean I am now using a very small subset of the new language features) but find that after the port and the change-over to Clang, build times are extremely long.

    Prior to the change I could clean and build everything in approx 1 min (GCC 4.6.3), after the changes and using Clang it now (consistently) takes 4+ min to compile the same application (this is all done via QtCreator).

    My setup is as follows:

    Ubuntu 12.04 LTS (32-bit)
    Qt 5.1.2 (built from source about 2 months ago)
    QtCreator 2.8.81 (based on Qt 5.1.2, built with GCC 4.6.3 at the same time as I built Qt)
    LLVM/Clang 3.4 (obtained and built exactly as per these instructions about a week ago: http://clang.llvm.org/get_started.html )

    I have also tried building a different branch of the qt creator source as per this article: http://procedural.tumblr.com/post/50723377576

    but find that my version of qmake is incompatible with the source from the clang-stable branch (I think...keep getting an error when running qmake about some plugin not being accessible/available...crap, I should have noted the error down last night...if it is important, I will find it again when I get home this afternoon).

    I have run out of ideas.

    Thanks for your help!

    http://www.goblincoding.com

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 27 Sept 2013, 06:34 last edited by
      #2

      wip/clang branch is not for compiling projects using clang! It is an experiment in using clang as a code model for Qt Creator itself.

      You can safely use standard Qt Creator (self-built or prebuilt), just set the clang Kit and it should work. I am surprised it takes longer for you to compile. I've always used prebuilt clang from apt-get (currently it's version 3.2 in Kubuntu 13.10) and it usually compiles stuff about 30% faster than GCC.

      (Z(:^

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goblincoding
        wrote on 27 Sept 2013, 07:32 last edited by
        #3

        [quote author="sierdzio" date="1380263679"]wip/clang branch is not for compiling projects using clang! It is an experiment in using clang as a code model for Qt Creator itself.[/quote]

        Aaah, thanks for clearing that confusion up for me Sierdzio!

        [quote]You can safely use standard Qt Creator (self-built or prebuilt), just set the clang Kit and it should work. I am surprised it takes longer for you to compile. I've always used prebuilt clang from apt-get (currently it's version 3.2 in Kubuntu 13.10) and it usually compiles stuff about 30% faster than GCC.[/quote]

        The official package for Ubuntu 12.04 still sits on 3.06 and the other (latest) available pre-built binaries (http://llvm.org/releases/download.html#3.3) don't seem to match my 32-bit system.

        I could probably either upgrade my distro or downgrade my clang version which would solve the immediate problem, but not answer the question as to why all my self-builts don't seem to perform as they should...I guess I have a bit more reading to do, I must have messed something up somewhere... :)

        http://www.goblincoding.com

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 27 Sept 2013, 07:38 last edited by
          #4

          Or maybe newer clang is slower :)

          (Z(:^

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goblincoding
            wrote on 27 Sept 2013, 18:06 last edited by
            #5

            OK, found the problem. When building LLVM from source (as per http://clang.llvm.org/get_started.html ), step six mentions the following re the default configuration:

            "This builds both LLVM and Clang for debug mode."

            I misinterpreted this to mean that it is required for debugging my software (as a drop-in replacement for gdb...you know what they say about assumptions...), but I was (horribly) mistaken. What it does is to build LLVM and Clang in debug mode for LLVM and Clang contributors.

            What you actually want is to run configure with the "--enable-optimized" flag set, i.e. replace the configure command under step 6 with:

            ../llvm/configure --enable-optimized

            (source: http://llvm.org/docs/GettingStarted.html#local-llvm-configuration)

            Build time down to <30 seconds... :D

            http://www.goblincoding.com

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sierdzio
              Moderators
              wrote on 27 Sept 2013, 21:30 last edited by
              #6

              Haha, yes, sometimes assumptions can cause unnecessary problems :) OK so now it seems you're all set up pretty nicely.

              (Z(:^

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goblincoding
                wrote on 28 Sept 2013, 06:49 last edited by
                #7

                Very nicely indeed, thanks! Clang rocks :)

                http://www.goblincoding.com

                1 Reply Last reply
                0

                1/7

                27 Sept 2013, 06:11

                • Login

                • Login or register to search.
                1 out of 7
                • First post
                  1/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved