clang: build failure on Ubuntu 11.10

Hi,

I tried building clag on Ubuntu 11.10 using instruction given at http://clang.llvm.org/get_started.html

The make command throws following error:

image001.jpg

What is your exact set up?

In reference on my system:

KNOWN:

Debian Sid/Unstable Kernel 3.2.

GCC DEFAULT SETUP:

gcc (Debian 4.7.2-4) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LLVM/Clang/LLDB/Compiler-RT/LIBCXX Trunk via SVN under their proper checkout points. [lldb/clang under /trunk/llvm/tools, compiler-rt/libcxx under /trunk/llvm/projects, test-suite/llvm-test under /trunk/llvm/projects]

CONFIGURATION CMAKE SETUP:

cmake version 2.8.9

PROCEDURE I USE TO BUILD:

Two stages.

Create a build directory for trunk against gcc outside of trunk.

$ mkdir cmake-gcc-trunk

Configure with cmake generic configuration with no optimization flags on the compilers just to get it to build.

user@host: cmake-gcc-trunk$ cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ …/trunk/llvm

user@host: cmake-gcc-trunk$ make

You can edit the CMakeCache.txt file and set up MinSizeRel, set BOOL to ON for LLVM_EXAMPLES, CLANG_EXAMPLES, TEST-SUITE, SHARED_LIBRARIES, etc.

You can also copy down all those areas you want configured how you want, put them in a shell script and run the steps to update your cmake config and thus keep the CMakeCache.txt file current.

Once you build and install into /usr/local

Create a build directory for trunk against clang/clang++ local outside of trunk.

$ mkdir cmake-clang-trunk

Configure with cmake generic configuration with no optimization flags on the compilers just to get it to build.

user@host: cmake-clang-trunk$ cmake -DCMAKE_C_COMPILER=/usr/local/clang -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ …/trunk/llvm

user@host: cmake-gcc-trunk$ make

From then on you only occasionally have to deal with broken updates via svn/git not fully up-to-date before clang/clang++ can self-host builds under /usr/local.

NOTE: On occasion ubuntu, debian and other distributions have to update their gcc defaults and made aware within llvm/clang when building against and trying to find the necessary header files, but that always gets resolved.

  • Marc