Not able to build the swift compiler

Hey @Shreyansh,
Couple of questions, what does xcode-select -p returns?
Also, which version of Xcode is Xcode 2? Are your command line tools correctly installed(did you try running xcode-select --install after selecting Xcode 2)?
We have seen something similar in Build failure locally, you can take a look there see if there is any useful info, this could be likely a mismatch of tools since you probably have more than one Xcode in your machine. So my guess would be try to make sure that everything is pointing to the correct one.