Something got broken in swift package manager starting from 5.2 on macOS - for some C system libraries that export pkg-config files swiftpm fails to find the appropriate .pc file. Tho on 5.1 it works fine. I'm experiencing this while using library called pango (https://pango.gnome.org/, available thru brew ton install locally). The same toolchain version on linux resolves headers and c-flags correctly.
So i wanted to debug the swift package manager itself. I tried both opening Package.swift of swift pm in Xcode 11.5 and generating an Xcode project, but swift-build (well, swiftc launched by swift-build) built from Xcode fails to compile the manifest file with error
Package.swift:9:8: error: no such module 'PackageDescription' on the targeted manifest file.
What am I doing wrong here?
How are you attempting to launch Swift-build? Can you also open a ticket on bugs.swift.org for the big you have found?
How are you attempting to launch Swift-build?
Literally got full swift source code via github repo and clone tool. I tried both the 5.2.4 release tag and master. After that i tried opening the Package.swift from swiftpm directory, got Xcode to generate schemas. In the schema editor I've added two command line arguments:
- "--package-path </path/to/package/with/issue>"
And hit run. Got the swiftc error. Then tried
swift package generate-xcodeproj, open that project, do same thing with command line arguments, hit run, swiftc error.
Honestly, I would prefer finding and fixing the original issue myself and creating a pull request because it blocks development of my pet project (i need the "resources" feature from swiftpm 5.3) rather than waiting till someone else fixes it, but I don't see a way to actually debug the swiftpm itself.
I'll look into resolving reproducing and resolving your swift-build issue. I'd love to see more contribution to SwiftPM
Not sure if this is exactly the same
'no such module 'PackageDescription' error, but I found a cheap workaround when I was trying to Run swift-package from Xcode is to modify the swift-package-manager Package.swift file to set
PackageDescription product as a dependency for
I had otherwise been able to execute tests, and build ok on both macOS and nightly-5.3-bionic. Only Run had the issue.
Package.swift line 151)
.target( /** The main executable provided by SwiftPM */ name: "swift-package", dependencies: ["Commands", "PackageDescription"]),