Swift Ios Build error due to sdk versions

Hello community,

I am trying to build a simple ios project using swift compiler (compiled from source). I was once able to achieve this but after OS update this doesn't seem to work anymore.

The command I ran:
SWIFT_EXEC=${bs}/swiftc swift build -Xswiftc "-sdk" -Xswiftc "xcrun --sdk iphonesimulator --show-sdk-path" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios15.2-simulator"

Output

:0: remark: did not find a prebuilt standard library for target 'x86_64-apple-ios-simulator' compatible with this Swift compiler; building it may take a few minutes, but it should only happen once for this combination of compiler and target
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:23825:24: error: module 'Builtin' has no member named 'targetOSVersionAtLeast'
let result32 = Int32(Builtin.targetOSVersionAtLeast(major32._value,
^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:1:1: error: failed to build module 'Swift'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5.2 (swiftlang-1300.0.46.202 clang-1300.0.29.30)', while this compiler is 'Swift version 5.6-dev (LLVM 30010bf3b070441, Swift 3290833eba4d9b3)'). Please select a toolchain which matches the SDK.
// swift-interface-format-version: 1.0
^
:0: remark: did not find a prebuilt standard library for target 'x86_64-apple-ios-simulator' compatible with this Swift compiler; building it may take a few minutes, but it should only happen once for this combination of compiler and target
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:23825:24: error: module 'Builtin' has no member named 'targetOSVersionAtLeast'
let result32 = Int32(Builtin.targetOSVersionAtLeast(major32._value,
^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:1:1: error: failed to build module 'Swift'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5.2 (swiftlang-1300.0.46.202 clang-1300.0.29.30)', while this compiler is 'Swift version 5.6-dev (LLVM 30010bf3b070441, Swift 3290833eba4d9b3)'). Please select a toolchain which matches the SDK.
// swift-interface-format-version: 1.0

I am not including the source as I am sure the problem is not there. Could anyone suggest a way to fix this. Thanks!