simolus3 / sqlite3.dart

sqlite3 bindings for Dart
MIT License
222 stars 74 forks source link

sqlite3 flutter libs v0.5.21 causes build to fail #231

Closed chris-NR closed 5 months ago

chris-NR commented 5 months ago

Upgrading Flutter (v3.22), Dart (v3.4) and the package dependencies has caused my iOS build to fail with the following error.

Error output ``` Launching lib/main.dart on iPhone in debug mode... Automatically signing iOS for device deployment using specified development team in Xcode project: 2QU963T8NU CocoaPods' output: ↳ Preparing Analyzing dependencies Inspecting targets to integrate Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``) Finding Podfile changes - Flutter - path_provider_foundation - sqlite3_flutter_libs Fetching external sources -> Fetching podspec for `Flutter` from `Flutter` -> Fetching podspec for `path_provider_foundation` from `.symlinks/plugins/path_provider_foundation/darwin` -> Fetching podspec for `sqlite3_flutter_libs` from `.symlinks/plugins/sqlite3_flutter_libs/ios` Resolving dependencies of `Podfile` CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: all_pods_versions_4_2_c.txt exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/4/2/c/FlutterMacOS/3.16.0/FlutterMacOS.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: all_pods_versions_d_c_2.txt exists! Returning local because checking is only performed in repo update 4 CDN: trunk Relative path: Specs/d/c/2/sqlite3/3.45.1/sqlite3.podspec.json exists! Returning local because checking is only performed in repo update [!] CocoaPods could not find compatible versions for pod "sqlite3": In snapshot (Podfile.lock): sqlite3 (= 3.45.1, ~> 3.45.1) In Podfile: sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`) was resolved to 0.0.1, which depends on sqlite3 (~> 3.45.3+1) Specs satisfying the `sqlite3 (= 3.45.1, ~> 3.45.1), sqlite3 (~> 3.45.3+1)` dependency were found, but they required a higher minimum deployment target. /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict' :90:in `tap' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:257:in `process_topmost_state' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:94:in `resolve' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:1082:in `block in resolve_dependencies' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:1080:in `resolve_dependencies' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:125:in `analyze' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:422:in `analyze' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:243:in `resolve_dependencies' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:162:in `install!' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in `run' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run' /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/bin/pod:55:in `' /usr/local/Cellar/cocoapods/1.15.2/libexec/bin/pod:25:in `load' /usr/local/Cellar/cocoapods/1.15.2/libexec/bin/pod:25:in `
' Error: The pod "sqlite3" required by the plugin "sqlite3_flutter_libs" requires a higher minimum iOS deployment version than the plugin's reported minimum version. To build, remove the plugin "sqlite3_flutter_libs", or contact the plugin's developers for assistance. Error: Error running pod install Exited (1). ```
Relevant section of pubspec ``` environment: sdk: ">=3.3.0 <4.0.0" dependencies: intl: platform: meta: async: drift: ^2.16.0 drift_dev: sqlite3: sqlite3_flutter_libs: ^0.5.0 path_provider: ^2.0.0 path: json_annotation: ^4.8.1 freezed_annotation: ^2.4.1 args: ^2.4.2 equatable: ^2.0.5 rxdart: bloc: ^8.1.0 bloc_concurrency: ^0.2.5 stream_transform: ^2.1.0 dev_dependencies: test: sprintf: flutter_lints: ^3.0.1 benchmark_harness: any build_runner: ^2.4.8 json_serializable: ^6.7.1 freezed: ^2.4.7 csv: ^6.0.0 ```
Output from flutter pub upgrade ``` Resolving dependencies... (2.0s) Downloading packages... _fe_analyzer_shared 67.0.0 (68.0.0 available) analyzer 6.4.1 (6.5.0 available) > args 2.5.0 (was 2.4.2) > build_daemon 4.0.2 (was 4.0.1) > build_runner 2.4.10 (was 2.4.8) > built_value 8.9.2 (was 8.9.1) > coverage 1.8.0 (was 1.7.2) > cupertino_icons 1.0.8 (was 1.0.6) > drift 2.18.0 (was 2.16.0) > drift_dev 2.18.0 (was 2.16.0) > flutter_lints 3.0.2 (was 3.0.1) (4.0.0 available) > freezed 2.5.2 (was 2.4.7) (2.5.3 available) > frontend_server_client 4.0.0 (was 3.2.0) > go_router 13.2.5 (was 13.2.0) (14.1.2 available) > js 0.7.1 (was 0.6.7) > json_annotation 4.9.0 (was 4.8.1) > json_serializable 6.8.0 (was 6.7.1) leak_tracker 10.0.4 (10.0.5 available) leak_tracker_flutter_testing 3.0.3 (3.0.5 available) lints 3.0.0 (4.0.0 available) material_color_utilities 0.8.0 (0.11.1 available) meta 1.12.0 (1.15.0 available) > path_provider 2.1.3 (was 2.1.2) > path_provider_android 2.2.4 (was 2.2.2) > path_provider_foundation 2.4.0 (was 2.3.2) shelf_web_socket 1.0.4 (2.0.0 available) > sqlite3 2.4.3 (was 2.4.0) > sqlite3_flutter_libs 0.5.21 (was 0.5.20) > sqlparser 0.36.0 (was 0.34.1) test 1.25.2 (1.25.5 available) test_api 0.7.0 (0.7.1 available) test_core 0.6.0 (0.6.2 available) vm_service 14.2.1 (14.2.2 available) > web 0.5.1 (was 0.5.0) > web_socket_channel 2.4.5 (was 2.4.4) (3.0.0 available) > win32 5.5.1 (was 5.2.0) Changed 24 dependencies! 16 packages have newer versions incompatible with dependency constraints. Try `flutter pub outdated` for more information. ```

If I pin the version to v0.5.20 the problem is resolved

simolus3 commented 5 months ago

The problem appears to come from https://github.com/clemensg/sqlite3pod/commit/a2b935e745bd4945474442b37a084ecd215c6a91. Can you check what the minimum ios deployment version is in your Podfile? XCode 15 apparently requires iOS 12 as a minimum which is why that was added to the upstream dependency. Do you need support for iOS 11 or older versions? Flutter claims to not support that either.

chris-NR commented 5 months ago

I think the podfile is the default that ships with flutter (I have not modified it). It does not specify an iOS version.

Podfile contents ```podfile # Uncomment this line to define a global platform for your project # platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, } def flutter_root generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) unless File.exist?(generated_xcode_build_settings_path) raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end File.foreach(generated_xcode_build_settings_path) do |line| matches = line.match(/FLUTTER_ROOT\=(.*)/) return matches[1].strip if matches end raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) flutter_ios_podfile_setup target 'Runner' do use_frameworks! use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end ```

I am using XCode 14. I can't upgrade to 15+ until I get a new macbook :confused:

simolus3 commented 5 months ago

Does it work if you uncomment platform :ios, '12.0'?

chris-NR commented 5 months ago

Hmmm, before updating the Podfile I unpinned sqlite3_flutter_libs, re-ran 'flutter pub upgrade' and checked to see that the original problem was still reproducible - and it wasn't !! Here is the latest output from the upgrade:

Upgrade output ``` Resolving dependencies... (1.8s) Downloading packages... _fe_analyzer_shared 67.0.0 (68.0.0 available) analyzer 6.4.1 (6.5.0 available) > args 2.5.0 (was 2.4.2) > build_daemon 4.0.2 (was 4.0.1) > build_runner 2.4.10 (was 2.4.8) > built_value 8.9.2 (was 8.9.1) > coverage 1.8.0 (was 1.7.2) > drift 2.18.0 (was 2.16.0) > drift_dev 2.18.0 (was 2.16.0) > flutter_lints 3.0.2 (was 3.0.1) (4.0.0 available) > freezed 2.5.2 (was 2.4.7) (2.5.3 available) > frontend_server_client 4.0.0 (was 3.2.0) > js 0.7.1 (was 0.6.7) > json_annotation 4.9.0 (was 4.8.1) > json_serializable 6.8.0 (was 6.7.1) lints 3.0.0 (4.0.0 available) material_color_utilities 0.8.0 (0.11.1 available) meta 1.12.0 (1.15.0 available) > path_provider 2.1.3 (was 2.1.2) > path_provider_android 2.2.4 (was 2.2.2) > path_provider_foundation 2.4.0 (was 2.3.2) shelf_web_socket 1.0.4 (2.0.0 available) > sqlite3 2.4.3 (was 2.4.0) > sqlite3_flutter_libs 0.5.21 (was 0.5.20) > sqlparser 0.36.0 (was 0.34.1) > test 1.25.2 (was 1.24.9) (1.25.5 available) > test_api 0.7.0 (was 0.6.1) (0.7.1 available) > test_core 0.6.0 (was 0.5.9) (0.6.2 available) > vm_service 14.2.2 (was 13.0.0) > web 0.5.1 (was 0.5.0) > web_socket_channel 2.4.5 (was 2.4.4) (3.0.0 available) > win32 5.5.1 (was 5.2.0) Changed 26 dependencies! 12 packages have newer versions incompatible with dependency constraints. Try `flutter pub outdated` for more information. ```

This puzzled me as I wasn't expecting anything other than the sqlite3_flutter_libs to change. On further investigation I think I understand what may have happened...

I have two packages in separate git repos. One for the UI and one for the Drift Database and other services. The 'Services package' only depends on flutter to enable the loading of the database from an asset as well as a file. The 'UI package' specifies it's dependency on the 'Services Package' via a local path in it's pubspec. This allows me to work on both packages simultaneously in a vscode workspace (I am the sole developer). I use 'test' for the Services and 'flutter_test' for the UI.

I hadn't appreciated (until now) that a consequence of this setup is that running 'flutter pub upgrade' on the 'UI package' does not upgrade the dependencies inside the 'Services Package'. The output in my original post, except for the pubspec (which was from the Services package 🙄 ), is from the 'UI package' and the output in this comment is from the 'Services package'.

I think I need to restructure my codebase - I will look at using a mono repo (like Drift) or using a 'proper' dependency rather than the path. I think this issue can be closed. Thanks for your support (and the excellent Drift package) and sorry for the false alarm.

simolus3 commented 5 months ago

No problems, and hopefully pub workspaces will eventually fix these kinds of problems :)

By the way, since drift is a pure Dart package you can just add the sqlite3_flutter_libs package as a dependency to your UI/main app package and remove it from the services package. That might avoid these problems in the future as well.