How to solve: Multiple commands produce ... module.modulemap

I have an app that depends on two swift packages. If I include any one of the packages the project builds and works. If I include both packages at once I get an Xcode build error:

Multiple commands produce '...Xcode/DerivedData/Workspace-ejeewzlcxbwwtbbihtdvnvgjkysh/Build/Products/Debug/include/module.modulemap'

Here is an example project that reproduces the error:

I've flailed about trying various things, but no luck so far. I've mostly been using Xcode 14.3.1.

I control one of the packages, the other package is GitHub - MacPaw/Setapp-framework: Setapp Framework.

The package that I control is a:

  • Swift package
  • That wraps an xcframework
  • That wraps some rust code

The package is being generated from some rust code, so the end fix will be to change that code generation. Right now I'm just interested how to fix the core problem manually, I can mess with the code generation myself.

What do I need to do so that the module.modulemap in my package doesn't conflict with the module.modulemap in the Setapp package?


For anyone who runs into this problem I think I have a fix and have documented at end of README in linked repo.

I think the boiled down answer is that if your swift package references a framework, that framework needs to have unique name, plus unique internal names for headers, .a's, etc.

I'm curious why more people are running into this, so still quite possible there's a simpler more common solution.