Random rants from a KDE user which also works on making KDE more Hebrew friendly.

Sunday, February 28, 2010

Qt + clang

1) What is clang?
It's a c++ compiler that is been developed using llvm. It should be very fast, it consumes less memory, it's BSD licensed, it should eventually provide better optimizations. It's still beeing developed

2) Can it compile Qt?
Dunno, not always. It does not work for me, but some people have reported that it works for them.

3) me too! me too! me too! me too! me too!
ok, shut up and type this:

# get + build clang
mkdir -p ~/src/llvm/
svn co http://llvm.org/svn/llvm-project/llvm/trunk ~/src/llvm
mkdir -p ~/src/llvm/tools/clang/
svn co http://llvm.org/svn/llvm-project/cfe/trunk ~/src/llvm/tools/clang
mkdir -p ~/src/llvm/cmake-build
cd ~/src/llvm/cmake-build
cmake ../
make -j 127

# compile Qt using the new clang
mkdir $QTDIR/qt-build-clang
cd $QTDIR/qt-build-clang
export PATH=~/src/llvm/cmake-build/bin:$PATH
export CC=clang
export CXX=clang++
$QTDIR/configure

# next time, update:
svn up ~/src/llvm/ ~/src/llvm/tools/clang/


As you might guess by now clang is quite compatible with GCC, it behaves more or less like it, uses the same headers, and uses the same command line switches.

4) Yes, but can clang do this? nah nah nah nah nah nah nah ...
OMG... what is wrong with you? are you an orange...?


5) Is it ready for "enterprise"?
No. There are no reported compiles of a Linux kernel, it just recently became self hosting, and I still have problems compiling Qt with it. I even have problems with small applications.


// http://llvm.org/bugs/show_bug.cgi?id=6295
#include < new >
int main( int argc, char *argv[] )
{
return 0;
}


6) So? whats so good about it?
It's an alternative. Freedom is all about alternatives, they mean competition, which means improovement, which means better applications.

2 comments:

Pawel said...

Afaik it's not faster then GCC and I wouldn't count bsd license as an advantage.

Geoff said...

Clang is most definitely faster at compiling code than GCC.

For more information, Clang has some benchmarks.