cunarist / rinf

Rust for native business logic, Flutter for flexible and beautiful GUI
MIT License
1.88k stars 65 forks source link

How to obtain more detailed information? #297

Closed newproplus closed 6 months ago

newproplus commented 6 months ago

Report

Hey, guys. I just update rinf to 6.6.1, and got an error. My question is how to obtain more detailed information about this error, thank you.

Error:

E/flutter (22648): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'send_dart_signal_extern': undefined symbol: send_dart_signal_extern
E/flutter (22648): #0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33:70)
E/flutter (22648): #1      sendDartSignalExtern (package:rinf/src/interface_os.dart)
E/flutter (22648): #2      sendDartSignal (package:rinf/rinf.dart:45:3)
E/flutter (22648): #3      InvokeRequest.sendSignalToRust (package:xxx/messages/xxx.pb.dart:24:3)
E/flutter (22648): #4      _WebPageState._chanInvoke (package:xxx/xxx.dart:208:7)
E/flutter (22648): <asynchronous suspension>

My dart file like:

There is no syntax or type error.

var appDir = await getApplicationDocumentsDirectory();
r_invoke.InvokeRequest(
  reqStr: message, // it's a String
  appDir: appDir.path, // it's a String
).sendSignalToRust(null); // The error caused here, 208:7 starts after the dot.
final stream = r_invoke.InvokeResponse.rustSignalStream;
Future<RustSignal<InvokeResponse>> rResF = stream.last;

final rustResponse = await rResF;
InvokeResponse responseMessage = rustResponse.message;

My proto file like:

// [RINF:DART-SIGNAL]
message InvokeRequest {
  string req_str = 1;
  string app_dir = 2;
}

System Information

rustc --version outputs: rustc 1.75.0

flutter doctor outputs:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.7, on Debian GNU/Linux 12 (bookworm) 6.1.0-18-amd64, locale zh_CN.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.85.0)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!
temeddix commented 6 months ago

Hi @newproplus , thanks for leaving your issue here.

It looks like the symbol is missing is from your Rust library. Rinf recently organized the bridge code and the way of writing it has changed a little.

Take a look at this sample app:

What I think you need to do is:

If the problem persists, please let me know :)

newproplus commented 6 months ago

@temeddix Thank you, I found that the line rinf::write_interface!() in native/hub/src/lib.rs is missing.