I'm following the Getting Started Guide to get setup in Xcode. I've completed the Using Ninja with Xcode steps. When I run I get the following error: 'clang/Driver/Options.inc' file not found. I'm able to build/run just fine without Xcode.
Hi, in my case I built it successfully, but I got the error message.
/Users/karimzhang/Desktop/swift-project/build/SwiftBuildTest/main.swift:8:8: error: no such module 'Foundation'
import Foundation
^
<unknown>:0: note: did you forget to set an SDK using -sdk or SDKROOT?
<unknown>:0: note: use "xcrun swiftc" to select the default macOS SDK installed with Xcode
Program ended with exit code: 1
Hello @benn, I’m sorry this thread has gone unnoticed for so long! We ought to add an afterword to the guide telling you who to tag for questions on the forums.
For what it’s worth, the scheme editor screenshots show that the Build action has 2 targets, which is probably why the build was failing. The scheme should be set up to build a single target — the one you configured manually.
This project, swift-corelibs-foundation, provides an implementation of the Foundation API for platforms where there is no Objective-C runtime. On macOS, iOS, and other Apple platforms, apps should use the Foundation that comes with the operating system. Our goal is for the API in this project to match the OS-provided Foundation and abstract away the exact underlying platform as much as possible.
The Foundation for Darwin platforms is not open-source, but I presume the swift-corelibs-foundationJSONDecoder has a similar implementation.
I had the very same issue. I lost an hour until I realised I'd chosen wrong executable
.. which resulted in building the target from Swift.xcproject instead using one from Ninja build for that
Edit your schema:
in the Build section, remove any target, which is from Swift.xcproject
in the Run section, Info panel, chose Executable -> Other (!) -> and navigate to your Ninja build folder: swift-project/build/Ninja-*/swift-macosx-*/bin/<your executable>