Closed HankG closed 1 year ago
See the Dart tab at https://docs.objectbox.io/getting-started, specifically the part about "Deploying Dart-native projects".
If that doesn't answer your question, please follow up!
See the Dart tab at https://docs.objectbox.io/getting-started, specifically the part about "Deploying Dart-native projects".
If that doesn't answer your question, please follow up!
This is a Flutter app not a Dart native app. This problem doesn't exist on Mac or Windows just on Linux. It seems on those platforms the build script is correctly placing the objectbox library in the same location as the objectbox flutter libs plugin library. I think that should probably be what happens on Linux as well. Then when the app is linked it looks for it in the nested directory instead of elsewhere on the build system and it "just works" on the end user's machine.
Sorry, I quickly jumped to Dart native because as you said with Flutter the library is bundled automatically.
I could reproduce this on Ubuntu 22.04 using the relations example. The output of ldd objectbox_demo_relations
indeed has the following (after moving the bundle
folder into ~/Downloads/obx_demo
):
libobjectbox_flutter_libs_plugin.so => /home/<user>/Downloads/obx_demo/./lib/libobjectbox_flutter_libs_plugin.so
libflutter_linux_gtk.so => /home/<user>/Downloads/obx_demo/./lib/libflutter_linux_gtk.so
libobjectbox.so => /home/<user>/git/objectbox-dart/objectbox/example/flutter/objectbox_demo_relations/build/linux/x64/release/_deps/objectbox-download-src/lib/libobjectbox.so
It appears libobjectbox.so
is treated as a globally installed library. Will have to check if flutter_libs/linux/CMakeLists.txt
(same for sync_flutter_libs
) needs to be updated.
@HankG I've just released preview version 1.7.2-dev.0
which should resolve this issue by no longer linking the shared library into the built executable. Let me know if this resolves the issue for you as well.
(Note: using flutter pub upgrade
will not update to this preview version, manually change the version in your pubspec.yaml
instead and run flutter pub get
.)
I've confirmed that this is working now. Awesome! Thanks!
@HankG Thanks!
The fix is now available in the latest stable version 1.7.2
.
I'm experimenting with doing manual deployments of an app on many platforms including Linux. On the Linux platform the app won't start because it can't find the
libobjectbox.so
library. Looking at the executable withldd
it looks like the link is being set to a link one directly up from the bundle directory tobuild/linux/x64/release/_deps/...
rather than within thebuild/linux/x64/release/bundle/libs
folder. Ironically the filelibobjectbox_flutter_libs_plugin.so
is in that proper location so it is only the base library that causes the problem.Basic info (please complete the following information):
Steps to reproduce
flutter build linux --release
Expected behavior
The program runs without the need for manually copying libraries, setting LD_LIBRARY_PATH etc.