Compiling the SWIFT-5.1 compiler for iPhoneSimulator

Hi,

I've been trying to build the official Swift-5.1 branch for the iphonesimulator target, but I'm getting compiler errors. It's also not clear to me which build tool arguments are needed to cross-compile for iphonesimulator.

Currently I'm running the build command:

utils/build-script -r --cross-compile-hosts "iphonesimulator-x86_64" --stdlib-deployment-targets "macosx-x86_64 iphonesimulator-x86_64" --build-stdlib-deployment-targets "iphonesimulator-x86_64" --darwin-deployment-version-ios 9.0

I've had to add the minimum deployment version as otherwise I was getting TLS related undefined symbol errors.

Can anyone help me with the correct build script invocation?

I think your only mistake is specifying --cross-compile-hosts, as that will try to cross-compile the Swift compiler itself to run on an iphonesimulator, as can be seen in this single example of cross-compiling the Swift compiler to run on an iPhone. That build presets file should be a great help to you, as it has many common build-script configurations, including several that claim to build the Swift SDK for the simulator.