Problem while selfhosting LLVM and Clang

Hi, all

  I am trying to selfhost LLVM and Clang. Below is my flow,

Step 1. Build LLVM and Clang by using native gcc

$ ../llvm-2.9/configure --prefix=$INSTALL \
--enable-optimized

Step 2. Build LLVM and Clang by using clang built by step 1

$ CC=clang CXX=clang++ ../llvm-2.9/configure \
--prefix=$INSTALL --enable-optimized

  But in step 2, I have a compilation error below,

This looks relevant to me for your issue. Grabbing the cxxabi.h from there may work:

http://comments.gmane.org/gmane.comp.compilers.clang.devel/9391

Hi, Asron

This looks relevant to me for your issue. Grabbing the cxxabi.h from there
may work:

http://comments.gmane.org/gmane.comp.compilers.clang.devel/9391

  I am not sure where to put cxxabi.h. How can I let clang find this
header file while compiling LLVM and Clang (in step 2)?

  Thanks!

Regards,
chenwj

Hi, Asron

This looks relevant to me for your issue. Grabbing the cxxabi.h from there
may work:

http://comments.gmane.org/gmane.comp.compilers.clang.devel/9391

I am not sure where to put cxxabi.h. How can I let clang find this
header file while compiling LLVM and Clang (in step 2)?

You need to add it to somewhere that is in Clangs includes search path. E.g. $INSTALL/lib/clang/2.9/include perhaps.

Hi, Aaron

> I am not sure where to put cxxabi.h. How can I let clang find this
> header file while compiling LLVM and Clang (in step 2)?
>

You need to add it to somewhere that is in Clangs includes search path. E.g.
$INSTALL/lib/clang/2.9/include perhaps.

  Thanks for your help. Now I have another problem,

---
llvm[4]: Compiling Version.cpp for Release build
/nfs_home/chenwj/install/bin/clang++: /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/libstdc++.so.6: version `GLIBCXX_3.4.14' not found
(required by /nfs_home/chenwj/install/bin/clang++)
---

  I suspect the function AddDefaultCPlusPlusIncludePaths in
InitHeaderSearch.cpp takes GnuCPlusPlusIncludePaths in a FIFO
order. I guess since the path of gcc 4.5.2 comes before gcc
4.4.x, the above error occured. After removing the path
of gcc 4.5.2 from AddDefaultCPlusPlusIncludePaths, everything
works fine.

Regards,
chenwj