apollo-ios: Missing required module 'SQLiteObjc' when using Carthage

Something strange is happening when integrating ApolloSQLite framework using Carthage, starting from apollo-ios version 0.23.x upwards (0.22.x works fine.)

Starting from 0.23.0, Cartfile.private was removed so I removed explicit reference to SQLite as well as Starscream from my application’s Cartfile. However, I can’t get the application to build whenever I import ApolloSQLite framework, due to the compiler error. Also, on later versions (I checked only 0.27.1) the problem appears only when targeting a device.

Are there any migration steps I may have missed?

Versions:

macOS 10.15.4 Xcode 11.4 and 11.4.1 Carthage 0.34.0 apollo-ios 0.23.x or higher Tested only on ios builds.

Reproduction:

  1. Create an empty Xcode project
  2. Add Cartfile with apollo-ios 0.23.0 or higher: github "apollographql/apollo-ios" ~> 0.23
  3. Run carthage update --platform ios
  4. Add Apollo and ApolloSQLite frameworks to project
  5. Import ApolloSQLite anywhere
  6. Build app for a device
  7. Swift Compiler Error - “Missing required module ‘SQLiteObjc’”

Screen Shot 2020-05-13 at 9 56 00 pm

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (14 by maintainers)

Most upvoted comments

For anyone who’s been having trouble with this, I recommend updating to the new version of Carthage, ~0.36~ 0.35. In preparing for the 0.29.0 release it built the iOS SQLite library correctly on the first try, something it has literally never done before. Might have been a fluke, but worth a shot.

Certainly possible - one thing I’d be worried about with SQLite.swift is breaking either their local build or their Swift Package Manager/CocoaPods setup - I can definitely confirm that maintaining for three package managers is a bit of a house of cards 😆

@designatednerd Did some investigation with the repro steps in the description of this issue.

  1. Followed the steps in the description and hit the failure as described
  2. Made sure the Apollo and ApolloSQLite were in the carthage copy-frameworks phase
  3. Went into Carthage/Checkouts/SQLite.swift and rebuilt the project using swift package generate-xcodeproj, which generated SQLite.swift.xcodeproj
  4. Deleted SQLite.xcodeproj
  5. carthage build --platform ios
  6. Run and it worked for me

If you inspect SQLite.xcodeproj vs SQLite.swift.xcodeproj, you will notice that in SQLite.xcodeproj, the scheme does not indicate to build SQLiteObjc, where as the newly generated SQLite.swift.xcodeproj does.

Let me know if this works for folks!

This is really bizarre, even if I get it to work its gonna be a nightmare to reproduce on a ci pipeline.

Thanks for the heads up, Carthage really feels like a sinking ship atm. Swift 5.3 can’t come soon enough.

I’ve run into this repeatedly testing out new releases for Carthage - I genuinely can’t figure out what the series of steps necessary to get Carthage to actually build that module for iOS.

Here are things I’ve done that, in some combination but never a consistent one, will eventually get that module built:

  • Call carthage update, then stop after checkout and before build, and run carthage build instead
  • Delete the existing framework before running carthage update
  • Run carthage update to completion, delete and regenerate the framework with carthage build
  • Remove the framework from the application, then re-add it without changing anything, and have it completely inexplicably work.

These are the things I would recommend trying:

  • Mess around with above combinations
  • Putting SQlite.swift back into your own Cartfile - there may be something happening where things are being built correctly for direct dependencies but not transient dependencies
  • Switching to either Swift Package Manager or Cocoapods

To be honest I’m planning to drop official Carthage support as soon as reasonably possible (and that may be as soon as Swift 5.3, if the couple of SE proposals they implemented for that wind up working as expected), so longer-term the last option may be your best.