Linux unable to build UE4Editor

I am unable to build UE4Editor. I get the following build error when building on both Ubuntu 14.04 and 16.04 even though I followed the instructions on the README:

[1392/1436] Link (ld)
[1393/1436] Link (ld)
[1394/1436] Link (ld)
[1395/1436] Link (ld)
ERROR: UBT ERROR: Failed to produce item: /home/vinitha/workspaces/UnrealEngine/Engine/Binaries/Linux/
Total build time: 2073.57 seconds (Local executor: 0.00 seconds)
Makefile:188: recipe for target 'UE4Editor' failed
make: *** [UE4Editor] Error 5

On Ubuntu 14.04 I used clang 3.5 and on ubuntu 16.04 I used clang 3.8.