FYI: Using the Clang compiler
Lubos Lunak
l.lunak at suse.cz
Tue Jul 17 09:21:31 PDT 2012
This mail is actually primarily aimed at people who think they're happy with
GCC and wouldn't think of using any other compiler.
Some of you may have already noticed mentions of using the Clang compiler to
build LibreOffice. It's been possible to build LO with Clang for quite some
time (I've been using it for building master since April IIRC), so this just
to run past you the idea that you might perhaps try it out too.
I've written all the info I considered relevant to
https://wiki.documentfoundation.org/Development/Building_LibreOffice_with_Clang ,
so I'm not going to repeat it all here, but in a nutshell:
Binaries built using Clang are a little bit slower [2], but it has a number
of nice features for using it as the development compiler, most notably the
error/warning messages. GCC has gotten much better recently in this area, but
it still can't beat things like this:
$ g++ -Wall a.cpp -c
a.cpp: In function ‘int foo()’:
a.cpp:8:14: error: ‘bar’ was not declared in this scope
$ clang++ -Wall a.cpp -c
a.cpp:8:5: error: use of undeclared identifier 'bar'; did you mean 'baz'?
bar( str );
^~~
baz
a.cpp:3:6: note: 'baz' declared here
void baz( const std::string );
^
1 error generated.
Clang should work well with recent distributions, older ones may have too old
libraries to build LO without hassle (although LO internal copies of external
libs all work fine).
[1] And I kept some of the old info about MacOSX where I didn't know if it
still is relevant.
[2] This is all with Linux, as I haven't tested on any other platform. This
may be different e.g. with MacOSX or FreeBSD, which AFAIK are slowly moving
to Clang and phasing out GCC, although there presumably a big part are
political reasons (BSD-like license).
PS: In case you'll ever feel like posting a patch to the Clang mailing list,
be warned that they can be really anal about details and may have no problem
with holding your patch just because of silly details like temporary variable
naming or punctuation in comments.
--
Lubos Lunak
l.lunak at suse.cz
More information about the LibreOffice
mailing list