Closed LordCommanderMay closed 2 years ago
You need to either get a precompiled libzmq.so
library or compile it youself and copy it into the build folder
@enwi thanks for the quick response! I tried using the .so file from zmq fedora package and placed it next to the executable and the lib folder above it where I found another .so file for whatever reason running the 'flutter run' command deletes the so file in those locations. I also tried putting in just the build folder as you said. it does not delete it but still gives me the same error. I will next attempt to compile zmq myself but if you could be more specific about where .so library should go that would be very helpful thanks.
I don't know the exact place for linux, but for windows it goes here build\windows\runner\Debug\.
and build\windows\runner\Release\.
. Is the build output structure similar on linux?
I remember that @ach-ee added some instructions for Linux, maybe these help:
Installing libzmq and running dart pub add dartzmq
should be all that is required to use this package in your own application. To also run the example project, follow these steps:
flutter
flutter config --enable-linux-desktop
cd dartzmq/example
flutter create .
to enable linux desktop for this projectflutter run
[1,2,3,4,5]
No luck with either of your suggestions unfortunately.
DynamicLibrary _dlOpenPlatformSpecific(final String name,
{final String? path}) {
String fullPath = _platformPath(name, path: path);
return DynamicLibrary.open('/usr/local/lib/libzmq.so');
}
I replaced with the fullPath
variable with the actual full path and I am getting a slightly different error.
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Exception: Could not load any zeromq library
#0 ZContext._initBindings (package:dartzmq/src/zeromq.dart:77:7)
#1 new ZContext (package:dartzmq/src/zeromq.dart:66:5)
#2 main (package:remote_volume_control/main.dart:6:28)
#3 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:130:25)
#4 _rootRun (dart:async/zone.dart:1426:13)
#5 _CustomZone.run (dart:async/zone.dart:1328:19)
#6 _runZoned (dart:async/zone.dart:1861:10)
#7 runZonedGuarded (dart:async/zone.dart:1849:12)
#8 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:126:5)
#9 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
[dartzmq] Failed to load library zmq: Invalid argument(s): Failed to lookup symbol 'zmq_poller_new': /usr/local/lib/libzmq.so: undefined symbol: zmq_poller_new
[dartzmq] Failed to load library libzmq: Invalid argument(s): Failed to lookup symbol 'zmq_poller_new': /usr/local/lib/libzmq.so: undefined symbol: zmq_poller_new
[dartzmq] Failed to load library libzmq-v142-mt-4_3_5: Invalid argument(s): Failed to lookup symbol 'zmq_poller_new': /usr/local/lib/libzmq.so: undefined symbol: zmq_poller_new
any ideas? this .so was complied from the source code with cmake.
sean@sean-fedora /u/l/lib> nm -D libzmq.so.5.2.5 | grep poll
U epoll_create1@GLIBC_2.9
U epoll_ctl@GLIBC_2.3.2
U epoll_wait@GLIBC_2.3.2
U poll@GLIBC_2.2.5
0000000000072010 T zmq_poll
zmq_poller_new
is not exported on the Linux library
Then it can load the library, just that the version does not have support for zmq_poller
sorry I ran the command wrong..
sean@sean-fedora /u/l/lib> nm libzmq.so.5.2.5 | grep zmq_poller_new
0000000000072df0 t _Z14zmq_poller_newv
0000000000019a9c t _Z14zmq_poller_newv.cold
I am a bit of a noob when it comes to c-shared Libraries. maybe the linux x86 exports it differently? I have no idea.
After some research this seems to be more of a problem with how fedora/cmake version of zmq is complied so I'll close this
Then it can load the library, just that the version does not have support for
zmq_poller
Yes your right i remove all poller related variable and functions and it works
not entirely sure whats going on here the code is looking in the right place. any help would be appreciated