Hardware - Apple M2 Max
OS - Ventura 13.4
The issue happens while building a Swift project in release mode using the package manager.
a. First, I set up my local Swift development environment using the instructions in the Swift repo on Github.
b. In addition to the steps mentioned on Github, I checked out the
swift-DEVELOPMENT-SNAPSHOT-2023-05-09-a tagged versions of all the repos using the following command. I did this because I want to debug issues in a specific toolchain snapshot.
utils/update-checkout --tag swift-DEVELOPMENT-SNAPSHOT-2023-05-09-a
c. To build the project I used the build command mentioned on Github, verbatim.
utils/build-script --skip-build-benchmarks \ --skip-ios --skip-watchos --skip-tvos \ --swift-darwin-supported-archs "$(uname -m)" \ --sccache --release-debuginfo --swift-disable-dead-stripping
d. This step completed successfully and I had
swiftc and other binaries in my build folder at
a. After having built Swift from source I attempted to built Swift PM from source using the following command.
utils/build-script --skip-build-benchmarks \ --swift-darwin-supported-archs "$(uname -m)" --release-debuginfo \ --swiftpm --install-swiftpm \ // This is the path to the locally built Swift executables. // I'm using the locally built executables because that's what I'm guessing // the Swift PM must have been built with, in the toolchain snapshot. --native-swift-tools-path <WORKSPACE_ROOT>/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/bin/
b. The build command finally fails when trying to compile the actual Swift PM sources, with the following error.
/Users/kshitij/workspace/swift-project/swiftpm/Sources/PackageCollectionsSigning/CertificatePolicy.swift:103:93: error: cannot convert value of type 'PolicySet' (aka 'AnyPolicy') to expected argument type '() throws -> Policy' var verifier = Verifier(rootCertificates: CertificateStore(trustStore), policy: policySet) ^ /Users/kshitij/workspace/swift-project/swiftpm/Sources/PackageCollectionsSigning/CertificatePolicy.swift:103:28: error: generic parameter 'Policy' could not be inferred var verifier = Verifier(rootCertificates: CertificateStore(trustStore), policy: policySet) ^ /Users/kshitij/workspace/swift-project/swiftpm/Sources/PackageCollectionsSigning/CertificatePolicy.swift:103:28: note: explicitly specify the generic arguments to fix this issue var verifier = Verifier(rootCertificates: CertificateStore(trustStore), policy: policySet) ^ <<#Policy: VerifierPolicy#>>
- Is this the right way to build and install Swift PM using a locally built Swift toolchain?
- Is it possible that the Swift PM in the
swift-DEVELOPMENT-SNAPSHOT-2023-05-09-atoolchain snapshot never actually built using the Swift in the same toolchain snapshot? How can I even check the build status of a given toolchain snapshot? Or can I assume that all builds/tests for a given toolchain snapshot succeeded?
- Same question as the one asked here. Is it possible to tell your system Swift PM (one that comes with Xcode, let's say) to use the executables and libraries from the Swift you built locally?
I would truly appreciate your help .