I'm trying to configure a development environment for the SPM project. I've read the instructions in CONTRIBUTING.md. I have Xcode 13.4 installed, and I'm on MacOS 12.4.
I'm trying to use the SPM already installed to build SPM from the cloned project, but I'm facing some issues with some unresolved symbols. Here's a small portion of my terminal logs when I try building SPM using swift build:
swift-package-manager/Sources/Build/SPMSwiftDriverExecutor.swift:45:70:error:cannot find type 'TimePoint' in scope recordedInputModificationDates: [TypedVirtualPath : TimePoint]) throws -> ProcessResult {
swift-package-manager/Sources/Build/SPMSwiftDriverExecutor.swift:66:70:error:cannot find type 'TimePoint' in scope recordedInputModificationDates: [TypedVirtualPath : TimePoint]) throws {
If I try using Xcode to build it, it gives me more errors (I'm using the SwiftPM-Package scheme):
If you're trying to build the current top of the tree (that is, the latest commit on the main branch), then first and foremost you'll need to download and install a latest swift nightly toolchain. You can download that from Swift.org - Download Swift. Look for the link to Xcode, Universal, Trunk Development (main).
You'll need to install it, and if you want to use Xcode you'll need to activate that chain within Xcode. The instructions for that whole sequence are all in the same link, just a bit lower under installation.
I've just installed the latest toolchain, but unfortunately I keep receiving the same errors. I think I'm missing some configuration that's not listed in CONTRIBUTING.md.
I tried the same, but unfortunately I still can't get a successful build:
$ export TOOLCHAINS=swift
$ xcrun --find swift
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2022-09-12-a.xctoolchain/usr/bin/swift
$ swift build
However, I still see error: cannot find type 'TimePoint' in scope. Could you please tell me which snapshot did you use, i.e. which output do you see for xcrun --find swift?
The output of the xcrun --find swift command, after exporting the TOOLCHAINS variable, is /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2022-09-06-a.xctoolchain/usr/bin/swift
Did you select the newly installed toolchain in Xcode as well?
I installed the same toolchain, still no success unfortunately. When I open the Package.swift in Xcode 14.0, then select the toolchain and try to test SwiftPM-Package, I get a different error though: [...]Library/Developer/Xcode/DerivedData/swift-package-manager-heruuddjujodithhrfaclhnrmuph/SourcePackages/checkouts/swift-llbuild/lib/llvm/Support/include/llvm/Support/Chrono.h:104:30: error build: Missing '#include "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2022-09-06-a.xctoolchain/usr/bin/../include/c++/v1/ratio"'; 'ratio' must be declared before it is used
After jumping through some hoops I could manage to get my setup to work—for some reason it was not pulling the current main branch of swift-driver so TimePoint was missing, a swift package update made it work.