[cfe-users] Building llvm/clang with another version of clang

Edward Diener eldlistmailingz at tropicsoft.com
Sat Jan 5 09:58:51 PST 2013


On 01/05/2013 09:16 AM, Dmitri Gribenko wrote:
> On Sat, Jan 5, 2013 at 7:31 AM, Edward Diener
> <eldlistmailingz at tropicsoft.com> wrote:
>> Is it possible to build llvm/clang with a previous version of clang
>> installed as a binary ? If so, how do I get llvm/configure to use the binary
>> version of clang rather than gcc to build the latest version of llvm/clang ?
> 
> configure (but not CMake) will check for 'clang' in PATH and prefer to
> use it instead of 'gcc' or 'cc'.  So just ensure that the previous
> version of clang is in your PATH.

Yes, I discovered this. This contradicts what LLVM has in its own
getting started page at
http://llvm.org/docs/GettingStarted.html#local-llvm-configuration.

> 
> But please note that sometimes repositories in various distributions
> include outdated versions of clang (for example, Ubuntu 12.10 still
> ships clang 3.0).  I would recommend building clang with the default
> system compiler in that case.

I also found this out. If I try building the latest llvm/clang with
clang 3.0 it fails. It appears that the reason it fails is that it is
trying to use the gcc header files for the standard C++ libraries, which
an earlier version of clang does not accept, and/or it is not finding
standard C libraries.

Doesn't the clang 3.0 binaries ship with its own version of the C++ and
C header files ?




More information about the cfe-users mailing list