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

How to add missed .so libraries ? #442

Closed
nassimus26 opened this issue Sep 19, 2022 · 9 comments
Closed

How to add missed .so libraries ? #442

nassimus26 opened this issue Sep 19, 2022 · 9 comments
Labels
question Further information is requested

Comments

@nassimus26
Copy link

nassimus26 commented Sep 19, 2022

I am using Flutter Drift to use SqlLite and I have this exception at runtime :

Waiting for observatory port to be available...
[   +5 ms] [E] [WARN][(tid:4596)(_wl_egl_tizen_get_tizen_private)] Should create tpl_surface with this wl_egl_window first.
[   +2 ms] [WARN][(tid:4596)(_wl_egl_tizen_get_tizen_private)] All wl_egl_window_tizen APIs will be ignored.
[        ] [E] [WARN][(tid:4596)(wl_egl_window_tizen_set_buffer_transform)] wl_egl_window(0x815ee620) wl_output_transform(0) already rotated
[        ] [WARN][(tid:4596)(wl_egl_window_tizen_set_window_transform)] wl_egl_window(0x815ee620) window_transform(0) already rotated
[   +1 ms] [E] [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory
[   +1 ms] #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
[        ] #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
[        ] #2      _defaultOpen (package:sqlite3/src/ffi/load_library.dart:52:27)
[        ] #3      OpenDynamicLibrary.openSqlite (package:sqlite3/src/ffi/load_library.dart:127:12)
[        ] #4      sqlite3 (package:sqlite3/src/ffi/api/sqlite3.dart:11:38)
[        ] #5      _NativeDelegate.openDatabase (package:drift/native.dart:155:12)
[        ] #6      Sqlite3Delegate._createDatabase (package:drift/src/sqlite3/database.dart:73:11)
[        ] #7      Sqlite3Delegate.open (package:drift/src/sqlite3/database.dart:61:7)

The main error is :

Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory
How to add these libraries ?

And the tizen tools shoudn't add them automatically ?

@nassimus26 nassimus26 changed the title How to add .so libraries ? How to add missed .so libraries ? Sep 19, 2022
@swift-kim
Copy link
Member

A libsqlite3.so.0 binary is already shipped with every Tizen device, so the simplest way would be overriding sqlite3's loading path by calling open.overrideFor when your app starts (e.g. in the main function of your app). Please refer to flutter-tizen/plugins#277 (comment) for the full example.

The libsqlite3.so.0 shipped with the device is fairly old and thus may not support features needed by the Drift package. If you have your own libsqlite3.so built for your device's architecture (armel), you can copy the binary to your app's tizen\lib directory and it will be packaged along with your app into a TPK.

Another option is to use the sqflite package, if you don't specifically need to use Drift. Both packages are marked "Flutter Favorite" but I don't know which one is superior.

@swift-kim swift-kim added the question Further information is requested label Sep 19, 2022
@nassimus26
Copy link
Author

Thank you @swift-kim It's impossible to rewrite the project with another framework, I already tried to put all "*.so" in the lib folder, it didn't works, but I am not sure in which architecture they were compiled.

Thank you very much for the response, I should fix it with these informations,

@nassimus26
Copy link
Author

nassimus26 commented Sep 19, 2022

Hi @swift-kim , No matter witch library I put in the tizen\lib it still saying

Failed to load dynamic library 'libsqlite3.so': libsqlite3.so: cannot open shared object file: No such file or directory

I think the folder is not working at all

@swift-kim
Copy link
Member

None of them seems to be compatible. Have you tried the open.overrideFor solution? You should definitely go that way if it works.

@nassimus26
Copy link
Author

ok I will try, thanks

@nassimus26
Copy link
Author

nassimus26 commented Sep 19, 2022

Hi again @swift-kim , I don't understand what did make you understand that my device architecture is ARMEL, my emulator is TV-SAMSUNG-x86 when I run the build, I see :

executing: C:\tizen-studio\tools\ide\bin\tizen.bat build-native -C Debug -a x86

So I don't understand it should be x86 as the device architecture, but indeed when I put the x86 libraries, it dosn't work but the open.overrideFor seemes working so I don't understand !

@swift-kim
Copy link
Member

If you're on an emulator, yes, the architecture is x86. (If you're on a real TV device, the architecture is armel.)

The architecture is not the only condition for DynamicLibrary.open to succeed. For example, the "soname" (not the file name) of your library must exactly be libsqlite3.so. (You can check this with readelf -d on Unix but I don't know how to do it on Windows.) Also all of its dependencies must be present on your device at runtime. If the binary has not been built with the Tizen SDK toolchain, it's unlikely the dependencies are all present on Tizen devices.

Anyway, no further explanation should be necessary. Please just use open.overrideFor.

@nassimus26
Copy link
Author

@swift-kim thanks, I got it :), I need undertand it because it's not the only library I need to load, I need VLC also, so thanks again.

@swift-kim
Copy link
Member

You're welcome. If you need more help, please let us know. :)

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

No branches or pull requests

2 participants