tuist icon indicating copy to clipboard operation
tuist copied to clipboard

Crash in unit tests with enforceExplicitDependencies, tuist cache and dynamic framework GRDB

Open voidless opened this issue 1 year ago • 5 comments

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?

  1. Use sample project https://github.com/voidless/tuist_explicitDeps_issue
  2. run tuist install
  3. run tuist cache
  4. run tuist generate
  5. 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

voidless avatar May 28 '24 11:05 voidless

Thanks for reporting this @voidless. I added it to our backlog with high priority.

pepicrft avatar May 28 '24 14:05 pepicrft

@voidless does it work fine when enforceExplicitDependencies is disabled?

pepicrft avatar Jun 10 '24 09:06 pepicrft

@pepicrft Yes, I've retested on Tuist 4.16.1 and it only breaks with enforceExplicitDependencies enabled

voidless avatar Jun 11 '24 13:06 voidless

I'd recommend not using the flag. We are currently evaluating dropping it since this is a problem that Apple is already looking into.

pepicrft avatar Jun 11 '24 16:06 pepicrft

@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.

pepicrft avatar Jun 24 '24 08:06 pepicrft

I'm closing this as this variable will be now deprecated: https://github.com/tuist/tuist/pull/6869

fortmarek avatar Oct 14 '24 19:10 fortmarek