Reputation: 101
I have 2 Swift Package dependencies which both have a XCFramework binary target. Both xcframeworks have:
When I add these packages to my project I get the error:
Multiple commands produce '/Users/../Library/Developer/Xcode/DerivedData/../Build/Products/Debug-iphonesimulator/include/module.modulemap'
Command: ProcessXCFramework /Users/omran/Library/Developer/Xcode/DerivedData/../SourcePackages/checkouts/zebrabarcodescanner/Sources/ZebraScannerSDK.xcframework /Users/omran/Library/Developer/Xcode/DerivedData/../Build/Products/Debug-iphonesimulator/libsymbolbt-sdk.a ios simulator
Command: ProcessXCFramework /Users/omran/Library/Developer/Xcode/DerivedData/../SourcePackages/checkouts/verifonesdk/Sources/VMF.xcframework /Users/omran/Library/Developer/Xcode/DerivedData/../Build/Products/Debug-iphonesimulator/VMF.a iOS simulator
Seems like Xcode is trying to write both modulemaps to the same location... Is this a bug?
Upvotes: 2
Views: 1209
Reputation: 447
I was able to find a solution for this, sorry for the late reply ser @omranK. Answering your comment in concrete, I was using a XCFramework third party and I developed mine too, inside of both XCFrameworks, they had the module.modulemap
& a .h
file, and I was getting the same error you're getting.
The way I fixed it is by modifying my XCFramework, to just have the static library and manually adding the headers and module in my app, and defining the path of those in the Package.swift
path (I was using SPM)
So, let's say I have MyLibrary
which depends on two libraries: MyExternalLibrary
and AnotherExternalLibrary
, my Package.swift
looks something like:
import PackageDescription
let package = Package(
name: "MyLibrary",
platforms: [.iOS(.v15)],
products: [
.library(
name: "MyLibrary",
targets: ["MyLibrary"]),
],
dependencies: [
.package(name: "MyExternalLibrary", path: "../my_library"),
.package(url: "https://github.com/org/another_external_library", from: "0.1.1")
],
targets: [
.target(
name: "MyLibrary",
dependencies: [
"MyExternalLibrary",
"AnotherLibrary"
],
cSettings: [
.headerSearchPath("../../include")
]
),
],
swiftLanguageVersions: [.v5]
)
The important part is the cSettings
, where we explicitly define the headers path. Note that the include
folder is in the root of my app.
This solution was inspired from this link: https://www.reddit.com/r/swift/comments/oi632j/multiple_binary_xcframeworks_in_swift_package/
Hope this is helpful ser :-)
Upvotes: 3