I’m trying to add just-in-time compilation support to our library using Clang via the C++ API. Basically we generate C code and compile and and execute this code using Clang + LLVM JIT.
We’ve been struggling how to correctly handle includes to C standard library, e.g. “math.h” or “stdio.h”. If no paths are set, we get errors of the form:
foo.c:3:10: fatal error: ‘math.h’ file not found
Until now we’ve solved this by locating a math.h and stdio.h on the system. But this is not portable and I feel that there must be a better way. I read about “modules” in clang, and got the impression that headers like these should be available in binary form inside the clang binaries, but if this is the case, I’m not sure how to enable it.
I’m using llvm/clang from Homebrew, version 3.6.2.