Clang, #include <math.h>

Hi,

I’m working on a new llc target and would like to generate .ll code with Clang.

I find that I can’t #include <math.h>, if I specify my target, or eg mips, arm, bfin…

What must be done in order to do this?

Thank you,

Jonas Paulsson

Hi,

<math.h> is part of the C standard library, not part of the compiler headers. Clang does not provide it.

You could look into one of the “standard” standard libraries, such as RedHat Newlib or Glibc, compile that yourself for your target and point Clang at its /include directory.

Cheers,

James

Hi,

[Re-cc’ing list – please hit “reply to all”! J ]

You can’t just use your system C and maths libraries when cross-compiling. The C and especially math libraries make lots of assumptions about the underlying system – ABI, endianness and most importantly the assembly language for inline assembly.

You will need to cross-compile a C or math library.

Cheers,

James