objectbox / objectbox/objectbox-dart
Issue running on on NixOS
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 1.2k
- Forks
- 162
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
Basic info:
- ObjectBox version: objectbox: ^1.7.2, objectbox_flutter_libs: any, objectbox_generator: any
- Flutter/Dart SDK: Flutter 3.10.0, Dart 3.0.0
- Reproducible: Always
- Build OS: NixOS 23.05 (Stoat)
- Deployment device or OS: NixOS 23.05 (Stoat)
Steps to reproduce
- Build a project that uses objectbox_flutter_libs (or libobjectbox.so)
- Try to run it
- :(
Expected behavior
App would run
Code
N/A
Logs, stack traces
$ flutter run --device-id linux
{...}
flutter: Failed to load ObjectBox library. For Flutter apps, check if objectbox_flutter_libs is added to dependencies. For unit tests and Dart apps, check if the ObjectBox library was downloaded (https://docs.objectbox.io/getting-started).
flutter: Failed to load ObjectBox library. For Flutter apps, check if objectbox_flutter_libs is added to dependencies. For unit tests and Dart apps, check if the ObjectBox library was downloaded (https://docs.objectbox.io/getting-started).
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libobjectbox.so': libobjectbox.so: cannot open shared object file: No such file or directory
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
#2 _tryObjectBoxLibFile (package:objectbox/src/native/bindings/bindings.dart:84:29)
#3 loadObjectBoxLib (package:objectbox/src/native/bindings/bindings.dart:101:12)
#4 C (package:objectbox/src/native/bindings/bindings.dart:119:27)
#5 C (package:objectbox/src/native/bindings/bindings.dart)
#6 new Model (package:objectbox/src/native/model.dart:19:31)
#7 new Store (package:objectbox/src/native/store.dart:175:21)
#8 openStore (package:notes/objectbox.g.dart:90:5)
<asynchronous suspension>
#9 initStore (package:notes/store.dart:25:16)
<asynchronous suspension>
#10 main (package:notes/main.dart:10:3)
<asynchronous suspension>
$ ldd build/linux/arm64/debug/bundle/lib/libobjectbox.so
linux-vdso.so.1 (0x0000ffff86e80000)
libdl.so.2 => /nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/libdl.so.2 (0x0000ffff86d00000)
libstdc++.so.6 => not found
libm.so.6 => /nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/libm.so.6 (0x0000ffff86c50000)
libgcc_s.so.1 => /nix/store/x2f8wiip66lxf6zynscszpm4d990q098-xgcc-12.2.0-libgcc/lib/libgcc_s.so.1 (0x0000ffff86c10000)
libpthread.so.0 => /nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/libpthread.so.0 (0x0000ffff86be0000)
libc.so.6 => /nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/libc.so.6 (0x0000ffff86a30000)
/nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/ld-linux-aarch64.so.1 (0x0000ffff86e43000)
$ LD_LIBRARY_PATH=/nix/store/px2m9rmdcp245j1sdgdrhamlk6ph182b-gcc-12.2.0-lib/lib/ ldd build/linux/arm64/debug/bundle/lib/libobjectbox.so
linux-vdso.so.1 (0x0000ffff9919b000)
libdl.so.2 => /nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/libdl.so.2 (0x0000ffff99010000)
libstdc++.so.6 => /nix/store/px2m9rmdcp245j1sdgdrhamlk6ph182b-gcc-12.2.0-lib/lib/libstdc++.so.6 (0x0000ffff98de0000)
libm.so.6 => /nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/libm.so.6 (0x0000ffff98d30000)
libgcc_s.so.1 => /nix/store/px2m9rmdcp245j1sdgdrhamlk6ph182b-gcc-12.2.0-lib/lib/libgcc_s.so.1 (0x0000ffff98cf0000)
libpthread.so.0 => /nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/libpthread.so.0 (0x0000ffff98cc0000)
libc.so.6 => /nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/libc.so.6 (0x0000ffff98b10000)
/nix/store/0ckxcm0bnsh64a4vi40d5wjs96i014nl-glibc-2.37-8/lib/ld-linux-aarch64.so.1 (0x0000ffff9915e000)
To fix the issue I tried..
$ LD_LIBRARY_PATH=/nix/store/px2m9rmdcp245j1sdgdrhamlk6ph182b-gcc-12.2.0-lib/lib/ flutter run
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libobjectbox.so': libobjectbox.so: cannot open shared object file: No such file or directory
but it didn't work. I thought that the issue may be with flutter run overriding the LD_LIBRARY_PATH - so I've decided to test it another way:
$ flutter build linux
$ LD_LIBRARY_PATH=/nix/store/px2m9rmdcp245j1sdgdrhamlk6ph182b-gcc-12.2.0-lib/lib/ build/linux/arm64/debug/bundle/notes
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libobjectbox.so': libobjectbox.so: cannot open shared object file: No such file or directory
But it still doesn't work
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure on NixOS 23.05 with the listed Flutter and Dart versions, using objectbox_flutter_libs and the Linux run command. Start in package:objectbox/src/native/bindings/bindings.dart and compare the bundled libobjectbox.so dependencies shown by ldd; done means the ObjectBox library loads and the app runs without a manual LD_LIBRARY_PATH workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, nixos
- Domain
- databases, desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100