What configure options should I use to build clang with clang?

I having a hard time try to get it to build itself so can anyone help me here?

./configure CXX=clang++

./configure CXX=clang++

Can you compile hello world?


Your obvious need for all of those -I command line options means that there is something incorrect in the search paths to find the header files on your host.

You need a compiler that will just work like:

clang++ hello.cc -o hello

and have that just work.

Until then it doesn't matter what you pass to configure - you won't be able to compile clang with clang.


Your not helping at all. Your just restating the problem that I'm having. Yes clang doesn't include the headers by default, but what I can do about it? I just recently try rebuilding it with --with-cxx-include-root configure on and it still doesn't search for the header files by default. On the"getting started" one of the solutions is so vague when it says "changes the lines below to include that path". What changes exactly? Any examples?

You will likely need to modify clang to use the headers on your system. Take a look your sources for areas that look like the header paths you're including. I don't have a cygwin system handy so I don't know what those are. You may need to modify lib/Frontend/InitHeaderSearch.cpp to contain the correct values.

Otherwise you haven't included any commands you may have used to configure so I don't know what you've done wrong if anything.

You also need to likely specify a link path if the system g++ doesn't know how to link against the installed libstdc++ - the error that you have seems to indicate that your c++ library was compiled without cxa_atexit while your compiler thinks that you have it. I don't know what to do about that offhand, you'll probably need to debug the process yourself some.

Good luck.


Read the message again. It’s telling you to modify the clang sources and implement a “hack” by changing the lines to include the path to the correct C++ header files. The command in the first sub-bullet tells you how to get the paths to put in that file.

You realize of course that you’ll have to first build clang++ again with your system compiler before you can build clang with clang.


  1. If you intend to work on Clang C++ support, you may need to tell it how to find your C++ standard library headers. If Clang cannot find your system libstdc++ headers, please follow these instructions:
  • gcc -v -x c++ /dev/null -fsyntax-only’ to get the path.
  • Look for the comment “FIXME: temporary hack: hard-coded paths” inclang/lib/Frontend/InitHeaderSearch.cpp and change the lines below to include that path.