compile Clang with debug info


I compile clang from source following the steps on the website like:

  1. cd build/
  2. cmake -G “Unix Makefiles” …
  3. make

Now I want to get the binary code with debugging information, so what should I do?

I tried “cmake -G “Unix Makefiles” --enable-debug-symbols …”, but it does not work.



I think 'DEBUG' is the default but
you can also pass '-DCMAKE_BUILD_TYPE=DEBUG' explicitly
to CMake. See here for other options:


Yes, DCMAKE_BUILD_TYPE=DEBUG works perfectly. BTW, according to my test ‘DEBUG’ is off by default.


I am writing a libtooling tool.

In the command line we can use ‘-include’ to Include file before parsing. My questions is what is the corresponding API
to do this?

I tried Opts.Includes.push_back , but it seems not working.