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

Failed to load dynamic library lib/libsqlite3.so" not found #1073

Closed
TaifRaoof opened this issue Mar 4, 2021 · 16 comments
Closed

Failed to load dynamic library lib/libsqlite3.so" not found #1073

TaifRaoof opened this issue Mar 4, 2021 · 16 comments

Comments

@TaifRaoof
Copy link

when i create new project with flutter v2 and moor with v4.1 and sqlite3_flutter_libs v 0.4.0+1 an error appear with log.
i use macOS operating system and test this operation on more than one devices android system.
and also before update all library and with flutter v1.26 and moor v3.4 also an error occurred
while when i open old project it work correctly.

flutter_app_demo3/lib/libsqlite3.so" not found) E/flutter (22355): #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:55) E/flutter (22355): #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:20:12) E/flutter (22355): #2 _defaultOpen (package:sqlite3/src/load_library.dart:40:31) E/flutter (22355): #3 OpenDynamicLibrary.openSqlite (package:sqlite3/src/load_library.dart:110:12) E/flutter (22355): #4 sqlite3 (package:sqlite3/src/api/sqlite3.dart:9:34) E/flutter (22355): #5 sqlite3 (package:sqlite3/src/api/sqlite3.dart) E/flutter (22355): #6 _VmDelegate._createDatabase (package:moor/src/ffi/vm_database.dart:159:13) E/flutter (22355): #7 _VmDelegate.open (package:moor/src/ffi/vm_database.dart:138:7) E/flutter (22355): #8 DelegatedDatabase.ensureOpen.<anonymous closure> (package:moor/src/runtime/executor/helpers/engines.dart:253:22) E/flutter (22355): <asynchronous suspension> E/flutter (22355): #9 Lock.synchronized.callBlockAndComplete (package:moor/src/utils/synchronized.dart:18:16) E/flutter (22355): <asynchronous suspension> E/flutter (22355): #10 DatabaseConnectionUser.doWhenOpened.<anonymous closure> (package:moor/src/runtime/api/connection_user.dart) E/flutter (22355): <asynchronous suspension> E/flutter (22355):

@simolus3
Copy link
Owner

simolus3 commented Mar 4, 2021

It sounds like you can reproduce this with a new project, can you push an example for that to GitHub so that I can take a look at it?

@TaifRaoof
Copy link
Author

TaifRaoof commented Mar 4, 2021

I create another new project on my windows pc rather than macOS pc and also the same error logs. also tried with emulator android v30 sdk x86
I think there is some can not open lib\libsqlite3.so in both pcs
I spent more than 4 days and used all possible solves in GitHub issued in moor and stack Overflow but nothing change
in pubspec.yaml used :

dependencies:
  moor: ^4.1.0
  sqlite3_flutter_libs: ^0.4.0+1
  path_provider: ^2.0.1
  path: ^1.8.0

dev_dependencies:
  moor_generator:  ^4.1.0
  build_runner: ^1.11.5

@kuhnroyal
Copy link
Contributor

I noticed that I had to manually add sqlite3 in the latest version. Not sure if that has anything to do with it, but I would check the version you have in pubspec.lock just to be safe.

@TaifRaoof
Copy link
Author

yes I do it by install sqlite3 and update all pubspec.lock dependences and also I downgrade moor to 3.4.0 but the error also appear to me.

@simolus3
Copy link
Owner

simolus3 commented Mar 4, 2021

I noticed that I had to manually add sqlite3 in the latest version

Were there related issues with a previous version? Or is this just to avoid compiler lints about empty structs?

Anyway, I tried to reproduce this (on Linux) by running:

  • flutter create (I'm on Flutter 2.0.0)
  • Adding the dependencies you posted
  • Using the file below in lib/main.dart
  • Using flutter run on an Android emulator
import 'package:flutter/material.dart';
import 'package:sqlite3/sqlite3.dart';

void main() {
  print(sqlite3.version);
  runApp(Container());
}

Everything works fine for me. You probably tried this already, but does flutter clean help at all?

@kuhnroyal
Copy link
Contributor

@simolus3 I am not sure, I am stuck somewhere between 3.1.0 and 4.0.0. Won't be able to upgrade to 4.1.0 for a while but need some features around migrations that were added for the not release 3.5.0 version. And I had to configure it at some point.

@TaifRaoof
Copy link
Author

I noticed that I had to manually add sqlite3 in the latest version

Were there related issues with a previous version? Or is this just to avoid compiler lints about empty structs?

Anyway, I tried to reproduce this (on Linux) by running:

  • flutter create (I'm on Flutter 2.0.0)
  • Adding the dependencies you posted
  • Using the file below in lib/main.dart
  • Using flutter run on an Android emulator
import 'package:flutter/material.dart';
import 'package:sqlite3/sqlite3.dart';

void main() {
  print(sqlite3.version);
  runApp(Container());
}

Everything works fine for me. You probably tried this already, but does flutter clean help at all?

I install sqlite3 v1.0.0 and do it but the the same error appear in windows pc and macOS pc

@simolus3
Copy link
Owner

simolus3 commented Mar 4, 2021

@TaifRaoof Can you post a full example to GitHub? I can't reproduce what you're describing.

@hpn33
Copy link

hpn33 commented Mar 23, 2021

Failed to load dynamic library
i have same in windows

this my example:

https://github.com/hpn33/moor_shared
example branch

and should clone this for depen:
https://github.com/hpn33/undo/
null branch

@simolus3
Copy link
Owner

@hpn33 As explained here (see the code snippet at the end of the page), you need a special setup to use sqlite3 on Windows.

@hpn33
Copy link

hpn33 commented Mar 24, 2021

is work fine
thanks @simolus3

@simolus3
Copy link
Owner

simolus3 commented May 9, 2021

It looks like @hpn33's problem was solved and I can't act on this without further information from @TaifRaoof. If you have a small project that reproduces this please let me know, please be aware that you need to install sqlite on desktop operating systems.

@simolus3 simolus3 closed this as completed May 9, 2021
@kankadev
Copy link

kankadev commented Dec 9, 2021

Hi, I downloaded precompiled binaries for windows called "sqlite-dll-win64-x64-3370000.zip", extract it to a folder. Now I have two files in this folder. I added this folder to my PATH variable but got still the same error.

Edit: Sorry, it's working now after reboot.

@ChrisGy
Copy link

ChrisGy commented Oct 2, 2023

It may be late now, but if this happens on Linux, you need:
apt install sqlite3 libsqlite3-dev

@rcdo-dev
Copy link

Thanks @ChrisGy, your comment saved my day.

@Abdulla-Sirag
Copy link

@ChrisGy best comment here, thanks a lot.

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

8 participants