Crash in unit tests with enforceExplicitDependencies, tuist cache and dynamic framework GRDB
What happened?
enforceExplicitDependencies causes unit tests to crash when loading cached dynamic framework CSQLite (part of GRDB)
without tuist cache or without enforceExplicitDependencies it works as expected
How do we reproduce it?
- Use sample project https://github.com/voidless/tuist_explicitDeps_issue
- run
tuist install - run
tuist cache - run
tuist generate - select scheme Feature and run unit tests
Error log
Error loading /Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/FeatureTests.xctest/FeatureTests (156): dlopen(/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/FeatureTests.xctest/FeatureTests, 0x0109): Library not loaded: @rpath/CSQLite.framework/CSQLite
Referenced from: <C5F5A2E9-ABBE-3F13-AB27-23ACA60251E5> /Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/GRDB.framework/GRDB
Reason: tried: '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/CSQLite.framework/CSQLite' (no such file), '/usr/lib/swift/CSQLite.framework/CSQLite' (no such file, not in dyld cache), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/GRDB.framework/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/FeatureTests.xctest/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/0e25a272d1601fe7e5900baa0fbeafaa/CSQLite.framework/CSQLite' (no such file), '/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/0e25a272d1601fe7e5900baa0fbeafaa/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/e0ae7e4951bf21790079923458c8696e/CSQLite.framework/CSQLite' (no such file), '/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/e0ae7e4951bf21790079923458c8696e/CSQLite.framework/CSQLite' (no such file), '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/FeatureTests.xctest/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/0e25a272d1601fe7e5900baa0fbeafaa/CSQLite.framework/CSQLite' (no such file), '/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/0e25a272d1601fe7e5900baa0fbeafaa/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/e0ae7e4951bf21790079923458c8696e/CSQLite.framework/CSQLite' (no such file), '/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/e0ae7e4951bf21790079923458c8696e/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CSQLite.framework/CSQLite' (no such file)
The bundle “FeatureTests” couldn’t be loaded. Try reinstalling the bundle.
(dlopen(/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/FeatureTests.xctest/FeatureTests, 0x0109): Library not loaded: @rpath/CSQLite.framework/CSQLite
Referenced from: <C5F5A2E9-ABBE-3F13-AB27-23ACA60251E5> /Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/GRDB.framework/GRDB
Reason: tried: '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/CSQLite.framework/CSQLite' (no such file), '/usr/lib/swift/CSQLite.framework/CSQLite' (no such file, not in dyld cache), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/GRDB.framework/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/FeatureTests.xctest/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/0e25a272d1601fe7e5900baa0fbeafaa/CSQLite.framework/CSQLite' (no such file), '/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/0e25a272d1601fe7e5900baa0fbeafaa/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/e0ae7e4951bf21790079923458c8696e/CSQLite.framework/CSQLite' (no such file), '/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/e0ae7e4951bf21790079923458c8696e/CSQLite.framework/CSQLite' (no such file), '/Users/user/Library/Developer/Xcode/DerivedData/Issue-fgwtgnbdxownyxdlskrpztiofuqy/Build/Products/Debug-iphonesimulator/FeatureTests.xctest/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/0e25a272d1601fe7e5900baa0fbeafaa/CSQLite.framework/CSQLite' (no such file), '/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/0e25a272d1601fe7e5900baa0fbeafaa/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/e0ae7e4951bf21790079923458c8696e/CSQLite.framework/CSQLite' (no such file), '/Users/user/develop/_bugreport/tuist_explicitDeps_issue/../../../.cache/tuist-cloud/BinaryCache/e0ae7e4951bf21790079923458c8696e/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/CSQLite.framework/CSQLite' (no such file), '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib/CSQLite.framework/CSQLite' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CSQLite.framework/CSQLite' (no such file))
Program ended with exit code: 83
macOS version
14.5
Tuist version
4.16.1
Xcode version
15.4.0
Thanks for reporting this @voidless. I added it to our backlog with high priority.
@voidless does it work fine when enforceExplicitDependencies is disabled?
@pepicrft Yes, I've retested on Tuist 4.16.1 and it only breaks with enforceExplicitDependencies enabled
I'd recommend not using the flag. We are currently evaluating dropping it since this is a problem that Apple is already looking into.
@voidless, we are currently looking into changing the approach here a bit and building something based on static code analysis. We belive it's a better solution forward because it's more reliable than trying to solve it at build-time with the primitives that Xcode and Xcode projects provide. I'll update you once we have some news in this front.
I'm closing this as this variable will be now deprecated: https://github.com/tuist/tuist/pull/6869