What are its advantages ? It's a compiler written from scratch, its code is completely modular and easily readable, it aims to offer user-friendly expressive diagnostics, it's much smaller and faster than gcc, it's expected to support IDE integration and code analysis and it's compatible with gcc. The C part of the compiler is in an advanced stage and can build large projects, like sqlite and the FreeBSD kernel. The C++ part is in an early stage (clang can't compile itself, for example).
Quick start:
$ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
$ cd llvm/tools
$ svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
$ cd ..
$ ./configure --prefix=/opt/clang
$ make
$ sudo make install
In the sequence above, llvm is the compiler back end and clang is the compiler front end. The compiler is installed in the /opt/clang directory, so it's available at /opt/clang/bin/clang (the directory can be deleted for a full uninstall when you're done).
Try it out:
$ cat hello.c
#include "stdio.h"
int main (void) {
printf("Hello world!\n");
return 0;
}
$ /opt/clang/bin/clang -o hello hello.c
$ ./hello
Hello world!
$ tar xf lame-398-2.tar.gz
$ cd lame-398-2
$ ./configure --prefix=/opt/lame CC=/opt/clang/bin/clang
$ make
$ sudo make install
$ /opt/lame/bin/lame myaudio.wav
As you can see, clang is in development stage, so it's only available trough svn.
Do you want to contribute ? See more information at clang home page !
No comments:
Post a Comment