Skip to content

SPM build fails with “Multiple commands produce …/include/module.modulemap” when used alongside swift-sodium #248

@Jevaites

Description

@Jevaites

Summary

When adding starknet.swift to a project that also depends on swift-sodium, the build fails with a duplicate output error for module.modulemap.

Steps to Reproduce

  1. Create a macOS Command Line Tool (Swift) in Xcode.
  2. Add dependencies:
    • software-mansion/starknet.swift
    • jedisct1/swift-sodium
  3. Build.

Actual Results

Build fails with:

  • warning: duplicate output file '.../Build/Products/Debug/include/module.modulemap'
  • error: Multiple commands produce '.../Build/Products/Debug/include/module.modulemap'
    • Command: ProcessXCFramework .../starknet.swift/Frameworks/CryptoRs.xcframework ...
    • Command: ProcessXCFramework .../swift-sodium/Clibsodium.xcframework ...

Expected Results

Project builds without errors.

Root Cause (analysis)

Both packages ship a binary target with a top-level Headers/module.modulemap. SwiftPM/Xcode flattens Headers/* from binary targets into a shared Build/Products/<config>/include/ directory. That causes both packages to try to write include/module.modulemap, producing the collision.

Proposed Fix

Relocate CryptoRs’ module map into Modules/module.modulemap (per Clang/Swift conventions) and reference headers relatively:

module CryptoRs {
  header "../Headers/crypto-rs.h"
  export *
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions