How to install clang compiler ?
-
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. -
Never done that, but it definitely is possible. Visit "llvm.org":http://llvm.org/ for more info.
-
Hi
clang is a objective C compiler for the Qt If you like to use Objective C for your Qt project its better compiler .
Thanks
Diluka -
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
-
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.
-
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
-
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.
-
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 tooComparison 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
-
I'm happy it worked for you. Happy coding!
-
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. -
Thanks,
This is where we get still better knowledge,
http://doc.qt.digia.com/4.7/qmake-variable-reference.html#qmake-cxxThanks,
-
-
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.