Shadowman
Shadowman

Reputation: 12099

Swift Package Manager: "multiple targets named..."

I'm trying to build a server-side Swift web application. The foundational framework for my app will be Kitura from IBM. Additionally, I would also like to make use of the aws-sdk-swift framework for calls in to AWS. However, when I declare both libraries as dependencies in my Package.swift file, I get an error saying:

'Kitura-net' /Volumes/Untitled/SwiftDev/MyApp/.build/checkouts/Kitura-net.git--7410958935072501107: error: multiple targets named 'CHTTPParser'

If I comment out the aws-sdk-swift dependency, everything works fine. If I uncomment it and comment out the Kitura dependency, everything works fine. But clearly there is a conflict between them on CHTTPParser. My question is, how do I resolve it? I've never seen this error before, and a quick Google search turned up nothing. Any ideas?

Upvotes: 2

Views: 2329

Answers (1)

Awishart
Awishart

Reputation: 41

You're seeing the error because both Kitura and aws-sdk-swift have a different dependency called CHTTPParser. Kitura requires https://github.com/IBM-Swift/CHTTPParser, but aws-sdk-swift indirectly requires https://github.com/ZewoGraveyard/CHTTPParser through depending on aws-sdk-swift-core then Prorsum. Swift Package Manager can't currently deal with dependency naming collisons.

It looks like the aws-sdk-swift dependency has been deprecated (it's in Zewo's 'Graveyard'), but this issue exists in its sub-dependency which looks like the author is intending to move away from Prorsum, which directly requires the deprecated dependency.

It's unfortunate that you've hit the problem, but as there's no way for SPM to deal with this currently you'll either have to find an alternative to aws-sdk-swift, wait for it to be changed to not use the out-of-date dependency or try forking the repos and making the changes yourself!

Upvotes: 4

Related Questions