[LLVMdev] Building llvm from source with clang instead of gcc

Edward Diener eldlistmailingz at tropicsoft.com
Sat Jan 5 20:08:49 PST 2013

On 1/5/2013 8:01 PM, Justin Holewinski wrote:
> On Sat, Jan 5, 2013 at 5:59 PM, Edward Diener
> <eldlistmailingz at tropicsoft.com <mailto:eldlistmailingz at tropicsoft.com>>
> wrote:
>     On 01/05/2013 01:11 PM, Dmitri Gribenko wrote:
>         On Sat, Jan 5, 2013 at 7:48 PM, Edward Diener
>         <eldlistmailingz at tropicsoft.__com
>         <mailto:eldlistmailingz at tropicsoft.com>>  wrote:
>             I actually found out that llvm/configure will choose clang
>             if it is
>             found in the path. This contradicts what is written at
>             http://llvm.org/docs/__GettingStarted.html#__requirements
>             <http://llvm.org/docs/GettingStarted.html#requirements>,
>             where it says it
>             will use the first GCC it finds. Perhaps that explanation
>             needs to be
>             updated.
>         Updated docs in r171630.
>             Finally I found that if llvm/configure uses clang instead of
>             gcc, it
>             invariably fails on my Linux distros because it is using the gcc
>             distributed included directories and an earlier version of
>             clang will
>             often fail with these gcc header files. Once I force
>             llvm/configure to
>             use gcc, building llvm/clang succeeds again.
>         Right.  Maybe we need to skip old clang versions in this case.
>     I think this should be done until clang can use its own header files
>     and libraries, when it is installed as a binary, rather than the
>     ones that gcc installs. In fact I am a bit amazed that clang does
>     not already have its own header files and libraries for use when one
>     tries llvm/configure and it sets up llvm's build system to use clang
>     as its compiler. Is this the fault of clang or is it the fault of
>     the llvm/configure system ?
> There is no complete solution for LLVM-only headers/libraries yet on
> Linux.  For C++, you can use libc++, but you still need some GCC
> libraries (or alternatives).  And you will at least need glibc or
> another compatible C runtime.

Should not what it is needed by clang to work correctly under Linux be 
posted somewhere on the clang Getting Started web page ? Even what you 
posted above requires guesswork on my part.

Am I supposed to install libc++ and glibc in a Linux distro for clang to 
work correctly ?

Which versions do I need ?

How do I tell clang what to use or is this automatically figured out by 
clang ?

Will llvm/configure use these libraries if I let it choose a clang 
binary in order to build the latest llvm/clang from source ?

More information about the llvm-dev mailing list