"Could not find or use auto-linked library" during linking

Hey! I would greatly appreciate your help with the following problem:

I'm trying to link multiple .o files to create an executable using the Swift toolchain (not using Xcode or SwiftPM). Previously (using the swift-5.2.4-RELEASE toolchain), the following command did the job and emitted an executable:

/path/to/toolchain/usr/bin/swift --driver-mode=swiftc -emit-executable main.o library.o anotherLibrary.o

But when I use the swift-5.3-RELEASE toolchain, I get these errors:

ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftsimd'
ld: warning: Could not find or use auto-linked library 'swiftGLKit'
ld: warning: Could not find or use auto-linked library 'swiftSceneKit'
ld: warning: Could not find or use auto-linked library 'swiftModelIO'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftAppKit'
ld: warning: Could not find or use auto-linked library 'swiftIOKit'
ld: warning: Could not find or use auto-linked library 'swiftXPC'
ld: warning: Could not find or use auto-linked library 'swiftCoreData'

When I compared the package content of the two versions of the toolchain, I noticed that the 5.2.4 toolchain included all of the libraries that I need in the usr/lib/swift/macosx directory, while the 5.3 toolchain doesn't seem to include these.
I'm not sure if this is the cause of the problem, but if it is, I suppose I need to give the compiler a search path for these libraries on my machine? What would that look like? Or am I missing something else?

Again, any ideas or help would be greatly appreciated!

Found the issue!
I needed to set the path to the macOS SDK. The command now looks like this:

/path/to/toolchain/usr/bin/swift --driver-mode=swiftc -emit-executable main.o library.o anotherLibrary.o -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
Terms of Service

Privacy Policy

Cookie Policy