1

I want to do some program analysis project on C program. So far, I want to get one C program as the input for clang, and then I use LLVM to make some analysis.

I want to do some experiment on gnu unix utility. For example: diff (https://www.gnu.org/software/diffutils/).

For example, when I want to do analysis on src/diff.c:

My command is: clang -emit-llvm -O0 -c diff.c -o test.bc

However I will get the below error:

./system.h:21:10: fatal error: 'config.h' file not found

which seems that clang cannot find config.h.

So my question is how to parse single program in a GNU utility? Do I need to write a Makefile or where can I find something like config.h?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
c21
  • 231
  • 3
  • 7
  • 1
    What you want is difficult. Note that diffutils uses the https://en.wikipedia.org/wiki/GNU_build_system . Have a look at http://stackoverflow.com/questions/16325718/building-autotooled-software-to-llvm-bitcode – Moritz Schauer Sep 20 '15 at 21:24
  • You will need to configure `diffutils` so that `config.h` has been created and is available. Then you may be able to analyze the single source file (and the headers it includes). Until then, you're going to run into problems continuously. – Jonathan Leffler Sep 20 '15 at 22:38

0 Answers0