Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to install clang compiler ?
Forum Updated to NodeBB v4.3 + New Features

How to install clang compiler ?

Scheduled Pinned Locked Moved Qt Creator and other tools
21 Posts 3 Posters 19.0k 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.
  • D Offline
    D Offline
    Diluka
    wrote on last edited by
    #1

    Hi

    I like to install clang compiler but i haven't any idea about steps which i want to do that ,please any one have better idea about that please describe.

    Thanks

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      What OS are we talking about here? On Mac, it's enough to install Xcode. On most linuxes, clang is included in the repository. On Windows, it gets tricky, but there are ways to compile the beast with MSVC11.

      For example, on Kubuntu:
      @
      sudo apt-get install clang
      @
      should do the trick.

      (Z(:^

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Diluka
        wrote on last edited by
        #3

        Thanks for your reply i like to know How clang install in Windows version

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Never done that, but it definitely is possible. Visit "llvm.org":http://llvm.org/ for more info.

          (Z(:^

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vishu
            wrote on last edited by
            #5

            @Dlluka
            hai,,
            I am stuck completely why llvm and why clang. And How to use it

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Diluka
              wrote on last edited by
              #6

              Hi

              clang is a objective C compiler for the Qt If you like to use Objective C for your Qt project its better compiler .

              http://clang.llvm.org/

              Thanks
              Diluka

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                Woah, not really. clang works with ISO C, ISO C++, Objective C and Objective C++. So there is bit more to this than just obj. C ;)

                vishu clang is a drop-in replacement for GCC/ g++. There is a huge amount of advantages that it brings:

                • better code optimisation
                • better introspection (debugging)
                • smaller binaries
                • it compiles faster than GCC (not to mention MSVC). In my case, Qt5 compiles in about 23 minutes with GCC, and in about 15 minutes using clang
                • much better error and warning detection and phrasing: clang tells you exactly where the error is, why it's an error and very often recommends a fix
                • plus a myriad of other avanced features

                (Z(:^

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  vishu
                  wrote on last edited by
                  #8

                  Thanks slerdzlo ,

                  I have Qt 5.0.2 and Windows 7 32 bit,
                  Qt 5.0.2 have gcc 4.7, Still do we need to use it , if yes I am not getting how to create tool chain for it. Please suggest any idea....

                  Thanks

                  1 Reply Last reply
                  0
                  • sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #9

                    OK Windows is a different thing. There I would recommend MSVC compiler.

                    You can compile clang on Windows, but it's not easy. Consult the llvm web page I've linked to earlier.

                    (Z(:^

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      vishu
                      wrote on last edited by
                      #10

                      Okay Today i will try out with windows itself if I don't get anything by the evening i ll install Linux and contact you.

                      Thanku

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        vishu
                        wrote on last edited by
                        #11

                        Hi slerdzlo,

                        It became Headache to me, i am switching to linux.
                        But i have one important question to you, We have one application which is developed in Qt 4.7 and we have cross compiled it and its running on ARM, Question is by using clang+llvm does it reduce memory size and increases the performance of the application????

                        Thanks

                        1 Reply Last reply
                        0
                        • sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #12

                          In many cases, the answer is yes, but you need to check yourself. It's not a magic do-it-all for you tool. If your code is badly written, it won't make it ultra fast all of a sudden.

                          (Z(:^

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            Diluka
                            wrote on last edited by
                            #13

                            Hi sierdzio

                            Good introduction thanks for your information i also new to clang but feel it very powerful rather than GCC. :)

                            1 Reply Last reply
                            0
                            • V Offline
                              V Offline
                              vishu
                              wrote on last edited by
                              #14

                              Hii slerdzlo,

                              Its very easy to install clang+llvm if we have linux like system and if we follow http://clang.llvm.org/get_started.html this Thanks for your guidence,
                              i got clang 3.4 and executed my qt(4.8.1) project and in GCC 4.6 too

                              Comparison between GCC 4.6 , clang 3.4

                              • Debug Time 37 seconds , 1 min 15 sec
                              • Warnings 23 , 43
                              • size of binary file 5.1 MB , 4.5 MB
                              1 Reply Last reply
                              0
                              • sierdzioS Offline
                                sierdzioS Offline
                                sierdzio
                                Moderators
                                wrote on last edited by
                                #15

                                I'm happy it worked for you. Happy coding!

                                (Z(:^

                                1 Reply Last reply
                                0
                                • V Offline
                                  V Offline
                                  vishu
                                  wrote on last edited by
                                  #16

                                  hi slerdzlo,

                                  I have one more question, I think we can set the GCC optimization level manually, Can you give any idea to set ?

                                  1 Reply Last reply
                                  0
                                  • sierdzioS Offline
                                    sierdzioS Offline
                                    sierdzio
                                    Moderators
                                    wrote on last edited by
                                    #17

                                    There are various optimisation settings available and many ways to turn them on. Most common settings are: -O2, -Od, -O3. They are well documented by both gcc and clang.
                                    If you mean to ask how to set this up in a qmake project, then the answer is that you need to use QMAKE_CXX_FLAGSvariable.

                                    (Z(:^

                                    1 Reply Last reply
                                    0
                                    • V Offline
                                      V Offline
                                      vishu
                                      wrote on last edited by
                                      #18

                                      Thanks,
                                      This is where we get still better knowledge,
                                      http://doc.qt.digia.com/4.7/qmake-variable-reference.html#qmake-cxx

                                      Thanks,

                                      1 Reply Last reply
                                      0
                                      • V Offline
                                        V Offline
                                        vishu
                                        wrote on last edited by
                                        #19

                                        Hi slerdzlo,

                                        I have one more task to do,
                                        Our target is to run the Qt Project in Arm board, We can directly compile using arm tool chain but our target is i have to run the code which is compiled with clang + llvm on Arm board,
                                        Any Idea Please....

                                        1 Reply Last reply
                                        0
                                        • sierdzioS Offline
                                          sierdzioS Offline
                                          sierdzio
                                          Moderators
                                          wrote on last edited by
                                          #20

                                          If you clang installation supports that architecture, you can compile and it should work. If it's some special custom chip, it may be that GCC is your only option. But that is not a place I have much experience in, so I can't say for sure.

                                          (Z(:^

                                          1 Reply Last reply
                                          0

                                          • Login

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