Hive
External SPM dependencies fail to build with “no such module” errors when using XcodeProj-based integration
GitHub issue · Open
What happened?
External SPM dependencies fail to build with “no such module” errors when using XcodeProj-based integration (Tuist/Package.swift). After running tuist install and tuist generate, the project generates successfully with all SPM packages converted to individual .xcodeproj files in Tuist/.build/tuist-derived/. However, when building any target that depends on these external packages, compilation fails with “no such module” errors.
Root cause:
External frameworks are referenced with sourceTree = BUILT_PRODUCTS_DIR in the main project Each SPM package builds into its own DerivedData directory (e.g., DerivedData/RxSwift-xxx/) The main project looks for frameworks in its own DerivedData (e.g., DerivedData/MyApp-xxx/) Frameworks are not found because they’re in different locations
Despite:
- buildImplicitDependencies = “YES” set in schemes
- All packages included in workspace-level scheme
- 1244+ PBXContainerItemProxy entries in project.pbxproj
- Correct framework references in build phases
The implicit dependency mechanism fails to locate built products across different project DerivedData directories.
Framework reference in main project:
MyApp.xcodeproj/project.pbxproj: 0FEE3F4B66E135E3B47098CC /* RxRelay.framework */ = { isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxRelay.framework; sourceTree = BUILT_PRODUCTS_DIR; // ⚠️ Points to main project's DerivedData };
How do we reproduce it?
Include multiple external packages in Package.swift and add them to the target via .external(name:). Do not use `resolveDependenciesWithSystemScm.```
Error log
/path/to/project/Domain/Checkout/CartBonusStorage.swift:3:8: error: no such module ‘RxRelay’ import RxRelay ^
/path/to/project/Domain/Managers/AppBadgeManager.swift:3:8: error: no such module ‘RxRelay’ import RxRelay ^
[… repeated for 19 files …]
** BUILD FAILED **
macOS version
26.2.0
Tuist version
4.131.1
Xcode version
26.2.0
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.
This happens because Tuist’s XcodeProj-based SPM integration generates a separate Xcode project for each package, so each package builds into its own DerivedData directory. The main project expects frameworks in its own DerivedData, but the SPM package builds put them elsewhere, causing the “no such module” errors. Tuist references frameworks using sourceTree = BUILT_PRODUCTS_DIR, which doesn’t resolve across these separate DerivedData locations, and there isn’t a built-in configuration or workaround to unify DerivedData or adjust framework search paths to fix this automatically docs, code.
Workarounds: use Xcode’s native SPM integration instead of XcodeProj-based, or always build the full workspace (not just the main project) so all dependencies are built and available community. If you need to share code across boundaries, consider turning it into a local Swift package. There is currently no documented or undocumented Tuist setting to resolve this DerivedData separation issue.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.