Using sysroot for 'iPhoneSimulator' but targeting 'MacOSX'

287 views Asked by At

I am trying to add a new build phase and run a .swift build script to process files.

When I try:

v Run Script

Shell /usr/bin/swift

# Type a script or drag a script file from your workspace to insert its path.
"${PROJECT_DIR}/BuildScript.swift"

Shell /bin/sh

/usr/bin/swift "${PROJECT_DIR}/BuildScript.swift"


In both cases, I get the following errors:

/<unknown>

/<unknown>:1:1 using sysroot for 'iPhoneSimulator' but targeting 'MacOSX'

/<unknown>:1:1 unable to load standard library for target 'arm64-apple-macosx13.0'

enter image description here

1

There are 1 answers

0
ScottyBlades On

So it turns out this is a better way to reference my file:

xcrun --sdk macosx swiftc -parse-as-library ScriptTarget/main.swift -o ScriptTargetOutput
./ScriptTargetOutput

I found a AF Swift Tutorial discussing it.

I wrote a medium article walking through the steps.