Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not build Objective-C module 'SQLite3' #3207

Open
psikosen opened this issue Sep 8, 2024 · 3 comments
Open

Could not build Objective-C module 'SQLite3' #3207

psikosen opened this issue Sep 8, 2024 · 3 comments

Comments

@psikosen
Copy link

psikosen commented Sep 8, 2024

Describe the bug
When trying to build for iOS `flutter build iOS

Redefinition of 'sqlite3_file
/Users/x/StudioProjects/app_name/ios/Pods/sqlite3/sqlite-src-3460100/sqlite3.h:731:8 Redefinition of 'sqlite3_file'
/Users/x/StudioProjects/app_name/ios/Pods/sqlite3/sqlite-src-3460100/sqlite3.h:837:8 Redefinition of 'sqlite3_io_methods
```

Libs
```
 drift: ^2.20.0
  sqlite3_flutter_libs: ^0.5.0
  drift_flutter: ^0.2.0

dev_dependencies:
  build_runner: ^2.4.12
  drift_dev: ^2.20.1

```
Anyone ran into a solution for this ? I tried a few things such as : Pod file
Getting rid of sqlite3 lib(flutter)
` pod 'SQLite.swift/standalone'
  #pod 'sqlite3', '~> 3.46.0'
  #pod 'sqlite3', '~> 3.35'
  #pod 'sqlite3', :modular_headers => true`
@dickermoshe
Copy link
Collaborator

sqlite3_flutter_libs should be removed. drift_flutter includes it automatically. I'm assuming there is some clashing going on.

@simolus3
Copy link
Owner

simolus3 commented Sep 9, 2024

I don't think that's it, drift_flutter simply depends on sqlite3_flutter_libs.

My best guess is that there's another dependency also linking sqlite3, does adding this snippet fix anything?

@ivanhercaz
Copy link

ivanhercaz commented Dec 3, 2024

My best guess is that there's another dependency also linking sqlite3, does adding this snippet fix anything?

I am having the same issue that @psikosen and the snippet suggested but @simolus3 doesn't seem to be working, at least for this case. I am trying to figure out how to solve it. If I get something useful, I will let you know.

Thanks for pointing to the snippet!

Update

After fighting a lot with that issue, I have to be honest: I really don't know how I "fixed" it. In the process of disabling some dependencies and trying to figure out why I was getting the redefinition error, I clean a lot of times the build directory and the pods (Pods and Podfile.lock).

When I was completely exhausted I returned to a previous commit to undo all my work, then clean the build directory but using Xcode (Product => Clean Build Folder) instead of flutter clean, then remove the Pods directory and the Podfile.lock, recover all the dependencies I had previously defined in pubspec.yml and finally run it again with VSCode and, suddenly, surprisingly, I didn't get the error.

I am not really happy with this, because I don't know exactly what happens beyond the possibility that the "Clean Build Folder" of Xcode cleans more than the flutter clean, but I don't know exactly what.

If I get more information, I will let you know. Just for reference, I leave here the dependencies I am using in my pubspec.yml file.

dependencies:
  device_info_plus: ^9.1.1
  drift: ^2.15.0
  flutter:
    sdk: flutter
  flutter_blue_plus: ^1.31.10
  flutter_native_splash: ^2.3.5
  flutter_riverpod: ^2.6.1
  freezed: ^2.4.6
  freezed_annotation: ^2.4.1
  go_router: ^13.0.1
  icons_plus: ^5.0.0
  json_annotation: ^4.8.1
  logger: ^2.0.2+1
  package_info_plus: ^4.2.0
  path: ^1.8.3
  path_provider: ^2.1.2
  permission_handler: ^11.2.0
  riverpod_annotation: ^2.6.1
  shared_preferences: ^2.2.2
  sqlite3: ^2.4.6
  sqlite3_flutter_libs: ^0.5.19
  flutter_spinkit: ^5.2.0
  dio: ^5.4.3+1
  embrace: ^3.0.1
  embrace_dio: ^3.0.0

Update

As another note, the only difference I see in my Podfile.lock from the current state to the previous (which was failing with the redefinition issue) is EmbraceIO and embrace_ios related pods updated from 6.4.2 to 6.5.0 and the sqlite3 pods added by sqlite3_flutter_libs. However, before the issues was "fixed" and after I have checked embrace dependency and it doesn't seem to include sqlite3 nor link it, and its changelog and commits history only indicates it updates the iOS SDK.

Updated

I confirm that my codebase is now running on both, iOS and Android, using the sqlite3_flutter_libs (v0.5.26).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants