compiler-rt build is failing


I am facing the following issue when trying to build compiler-rt:

In file included from /llvm/projects/compiler-rt/lib/sanitizer_common/
/llvm/projects/compiler-rt/lib/sanitizer_common/ In function ▒__sanitizer::uptr __sanitizer::internal_open(const char*, int)▒:
/llvm/projects/compiler-rt/lib/sanitizer_common/ error: ▒__NR_open▒ was not declared in this scope

define SYSCALL(name) _NR ## name

/llvm/projects/compiler-rt/lib/sanitizer_common/ note: in expansion of macro ▒SYSCALL▒
return internal_syscall(SYSCALL(open), (uptr)filename, flags);

When I checked, I can see the __NR_open call is defined in the following headers in my system:

$ grep -rni __NR_open /usr/include/

/usr/include/asm-generic/unistd.h:716:#define __NR_open 1024
/usr/include/asm/unistd.h:716:#define __NR_open 1024

Machine details:
Linux jctli20 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Ubuntu 14.04

Does anyone know what is going wrong and is there any workaround for this?