Hi everybody, tried to find similar question, there are some related but no solution thought…
We are building a product for macOS/Linux with Swift. Users are supposed to be able to extend functionality with own implemented plugins in Swift as well, so we have to provide kind of SDK with API using which users can add needed functionality. Our understanding is plugin will be a bundle with dynamic library which will be loaded into the running process, so SDK should also be a dynamic library. Looking at possibilities and taking into account that the product is not open source seems the only way to give an SDK to users is a XCFramework. We tried to create framework according to instructions at but unfortunately the result xcframework does not work, the compiler complains that module is not available (while it is definitely available in the framework, verified with adding a direct dependency to the Package.swift).
Steps to reproduce:
git checkout https://github.com/ordo-one/external-reproducers.git
cd external-reproducers/swift/xcframework-build-problem
./create_xcframework_and_build
As a result we have
xcframework-build-problem % ./create_xcframework_and_build
Cloning into 'package-distributed-system-conformance'...
…..
Building for debugging...
[67/67] Linking libDistributedSystemConformance.dylib
Build complete! (15.75s)
xcframework successfully written out to: /Users/mmm/external-reproducers/swift/xcframework-build-problem/DistributedSystemConformance.xcframework
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/Users/mmm/external-reproducers/swift/xcframework-build-problem/Sources/XCFrameworkTest/Main.swift:1:8: error: no such module 'DistributedSystemConformance'
import DistributedSystemConformance
^
/Users/mmm/external-reproducers/swift/xcframework-build-problem/Sources/XCFrameworkTest/Main.swift:1:8: error: no such module 'DistributedSystemConformance'
import DistributedSystemConformance
^
error: fatalError
Adding ‘-allow-internal-distribution’ command line option to the ‘xcodebuild’ solves the issue with DistributedSystemConformance module, but there is still unknown modules which DistributedSystemConformance module depends on. We can make an assumption that all dependencies of the DistributedSystemConformance should be delivered as XCFramework as well, but it is not a way we would like to go, would be really nice if end users will need to use only single dependency in their plugins.
Does anybody know how we could create a proper XCFramework which will work properly for us? Or should we go completely different way?
Thank you in advance and I look forward for your feedback.