Cannot use swift-markdown in package built for distribution

Hello I've already opened an issue for this in the swift-markdown repo but I figure I'd also try here.

I'm looking to consume swift-markdown as a package dependency but am hitting an issue with my daily CI job which archives my package using xcodebuild archive -scheme MyLibrary -destination generic/platform=iOS -archivePath /Users/[username]/Desktop/iOS.xcarchive BUILD_LIBRARY_FOR_DISTRIBUTION=YES.

The command fails with this error:

/Users/[username]/Library/Developer/Xcode/DerivedData/MyLibrary-guqxdcvdzivakeakwqoytmpxwgur/Build/Intermediates.noindex/ArchiveIntermediates/MyLibrary/IntermediateBuildFilesPath/swift-markdown.build/Release-iphoneos/Markdown.build/Objects-normal/arm64/Markdown.private.swiftinterface:4:8: error: no such module 'CAtomic'
import CAtomic
       ^
/Users/[username]/Library/Developer/Xcode/DerivedData/MyLibrary-guqxdcvdzivakeakwqoytmpxwgur/Build/Intermediates.noindex/ArchiveIntermediates/MyLibrary/IntermediateBuildFilesPath/swift-markdown.build/Release-iphoneos/Markdown.build/Objects-normal/arm64/Markdown.private.swiftinterface:1:1: error: failed to verify module interface of 'Markdown' due to the errors above; the textual interface may be broken by project issues or a compiler bug
// swift-interface-format-version: 1.0
^

** ARCHIVE FAILED **

Removing BUILD_LIBRARY_FOR_DISTRIBUTION=YES succeeds

** ARCHIVE SUCCEEDED **

I've tried

  • using the latest Xcode 16 betas
  • using @_implementationOnly import Markdown
  • using -skipPackageSignatureValidation

Any idea why the error is occurring or how I might resolve this?

The barebones package I've created as a reproducer for this is linked in the GitHub issue I linked above.

OTHER_SWIFT_FLAGS=-no-verify-emitted-module-interface seems to fix the error.