Brightify / Cuckoo

Boilerplate-free mocking framework for Swift!
MIT License
1.67k stars 174 forks source link

Crash on launch when adding Cuckoo to a new Xcode Project #443

Closed fraune closed 1 year ago

fraune commented 1 year ago

Hello, I'm having some trouble adding Cuckoo to a new project via Source Package Manager.

I am aware the following steps don't complete the setup for Cuckoo, especially using SPM, but they are the minimum steps I've found to replicate the issue I'm experiencing. If you are aware of some specific steps or settings I can apply to resolve this, I would appreciate your direction.

My steps to reproduce:

  1. Create a new iOS app in Xcode 14.2
  2. Add Cuckoo 1.9.1 as a project dependency
  3. Set ENABLE_TESTING_SEARCH_PATHS to Yes on the app target to prevent "undefined symbol" build errors
  4. Launch app on a simulator or physical device

Results The app builds successfully, but immediately after launch, I see a crash with the following error messages.

dyld[91530]: Library not loaded: @rpath/libXCTestSwiftSupport.dylib
  Referenced from: <90AD1A56-8E07-371F-9186-CEA56B1A0F00> /Users/user/Library/Developer/CoreSimulator/Devices/C39414A0-834B-4675-BF0A-B25E30140EE3/data/Containers/Bundle/Application/318227DB-6D86-4676-8C93-8AC321D19625/CuckooTest.app/CuckooTest
  Reason: tried: '/Users/user/Library/Developer/Xcode/DerivedData/CuckooTest-hixmkskpgtizgvgznftbyfuvhbkd/Build/Products/Debug-iphonesimulator/libXCTestSwiftSupport.dylib' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection/libXCTestSwiftSupport.dylib' (errno=2), '/Users/user/Library/Developer/CoreSimulator/Devices/C39414A0-834B-4675-BF0A-B25E30140EE3/data/Containers/Bundle/Application/318227DB-6D86-4676-8C93-8AC321D19625/CuckooTest.app/Frameworks/libXCTestSwiftSupport.dylib' (errno=2), '/Users/user/Library/Developer/CoreSimulator/Devices/C39414A0-834B-4675-BF0A-B25E30140EE3/data/Containers/Bundle/Application/318227DB-6D86-4676-8C93-8AC321D19625/CuckooTest.app/Frameworks/libXCTestSwiftSupport.dylib' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libXCTestSwiftSupport.dylib' (errno=2)
Library not loaded: @rpath/libXCTestSwiftSupport.dylib
  Referenced from: <90AD1A56-8E07-371F-9186-CEA56B1A0F00> /Users/user/Library/Developer/CoreSimulator/Devices/C39414A0-834B-4675-BF0A-B25E30140EE3/data/Containers/Bundle/Application/318227DB-6D86-4676-8C93-8AC321D19625/CuckooTest.app/CuckooTest
  Reason: tried: '/Users/user/Library/Developer/Xcode/DerivedData/CuckooTest-hixmkskpgtizgvgznftbyfuvhbkd/Build/Products/Debug-iphonesimulator/libXCTestSwiftSupport.dylib' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection/libXCTestSwiftSupport.dylib' (errno=2), '/Users/user/Library/Developer/CoreSimulator/Devices/C39414A0-834B-4675-BF0A-B25E30140EE3/data/Containers/Bundle/Application/318227DB-6D86-4676-8C93-8AC321D19625/CuckooTest.app/Frameworks/libXCTestSwiftSupport.dylib' (errno=2), '/Users/user/Library/Developer/CoreSimulator/Devices/C39414
dyld config: DYLD_SHARED_CACHE_DIR=/Users/user/Library/Developer/CoreSimulator/Caches/dyld/22C65/com.apple.CoreSimulator.SimRuntime.iOS-16-2.20C52 DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/user/Library/Developer/Xcode/DerivedData/CuckooTest-hixmkskpgtizgvgznftbyfuvhbkd/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/user/Library/Developer/Xcode/DerivedData/CuckooTest-hixmkskpgtizgvgznftbyfuvhbkd/Build/Products/Debug-iphonesimulator:/Users/user/Library/Developer/Xcode/DerivedData/CuckooTest-hixmkskpgtizgvgznftbyfuvhbkd/Build/Products/Debug-iphonesimulator/PackageFrameworks DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/
(lldb) 
fraune commented 1 year ago

I realized my mistake and resolved my issue. Cuckoo was added to the App target rather than the Test target.