Building Clang+LLVM using Clang

Hello,

I built the Clang using gcc and want to build Clang+LLVM using the already built Clang.

My compilation terminates by outputting following error messages:

/home/murat/llvm/lib/Support/IsInf.cpp:41:3: error: "Don't know how to get isinf()"
# error "Don't know how to get isinf()"
^
/home/murat/llvm/lib/Support/IsInf.cpp:46:30: error: use of undeclared identifier 'isinf'
int IsInf(float f) { return isinf(f); }
^
/home/murat/llvm/lib/Support/IsInf.cpp:47:30: error: use of undeclared identifier 'isinf'
int IsInf(double d) { return isinf(d); }
^
3 errors generated.
make[1]: *** [/home/murat/llvm/build/lib/Support/Release/IsInf.o] Error 1
make[1]: Leaving directory `/home/murat/llvm/build/lib/Support'
make: *** [all] Error 1

It seems the compilation cannot find the standard header files.

I compile using following flags:
-I/home/murat/llvm/build/include
-I/home/murat/llvm/build/lib/Support
-I/home/murat/llvm/include
-I/home/murat/llvm/lib/Support
-DNDEBUG
-D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS
-O0
-fomit-frame-pointer
-fno-exceptions
-fPIC
-Woverloaded-virtual
-Wcast-qual
-Wall -W -Wno-unused-parameter -Wwrite-strings -Wcovered-switch-default

Can anybody let me know which flags I need to compile Clang+LLVM using Clang and what I do wrong?

Thanks a lot for your help!
Murat

I think that everything should work if you use ./configure and make, provided that CXX environment variable points at Clang, but I might me wrong.

You could also skip the first part and download the official binaries for your platform from http://llvm.org/releases/download.html#3.1 and try using them instead of gcc-built clang (it will save you some time).

Your problem is a missing definition from a system header. Without knowing what your target OS is, no one will be able to help you...

David

Thanks David and Nikola for your replies.

I configure using following commands.

export CC=clang
export CXX=clang++
../configure --disable-assertions --enable-optimized --disable-shared --enable-targets=x86_64

I am trying to build it on a x86-64 architecture.
Do I need to provide more information to the Clang compiler?

Thanks a lot!
Murat

I build with either using the include Cmake option or autoconf/makefile option, but one thing is clear, just export CC=clang and export CXX=clang++ doesn’t cut it, especially on Linux.

My Linux System:

  • Debian Sid/Experimental
  • 3.2.x kernel with LLVM/Clang 3.1 installed under /usr
  • LLVM/Clang trunk installed under /usr/local
    So, if I’m going to move from GCC → self-hosting against the newly build llvm/clang from trunk I’m passing /usr/local/bin/clang and /usr/local/bin/clang++ in

For Cmake:

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/local/bin/clang++

//C compiler.
CMAKE_C_COMPILER:FILEPATH=/usr/local/bin/clang

via the

$ cmake -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ -DCMAKE_C_COMPILER=/usr/local/bin/clang …/trunk/llvm

and any other custom flags like CMAKE_CXX_FLAGS= and CMAKE_C_FLAGS= not to mention Boolean flags for optimizations according to what my CPU can muster.

The autoconf configure flags listed like you cite but I tend to pass

$ CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++ …/llvm/trunk/configure --disable-assertions --enable-optimized --disable-shared --enable-targets=x86_64 and --prefix=/usr/local

and any other flags I see fit.

  • Marc

It will if the clang and clang++ that you want to use are first in your path.

-eric

True. I just don’t like mucking with my path in bash when I already know I have a general release for clang/clang++ already by default active on the system.

  • Marc