fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
3.64k stars 256 forks source link

[Bug] Failed to lookup symbol 'store_dart_post_cobject' #754

Closed Roms1383 closed 1 year ago

Roms1383 commented 1 year ago

Describe the bug

Ok, this is the well-known bug that has been reported many times already. I got it in the past and got rid of it by following people's recommendations in Discussions or Issues. This time I'm stuck with this bug for over a couple of weeks and until now it was fine because I'll just run just test-pure-web instead or peek at the CI worklows execution (which just works fine, contrary to my machine lol). But this time I'm testing something and I would really like to be able to run just test-pure locally and track my progress here.

I've already tried a bunch of stuff before opening this Issue, also fixed paths around (now that we switched to cargo workspace, the target folder is systematically in root folder, not in each crate's folder).

Codegen logs with RUST_LOG=debug environment variable

click to display ```shell ➜ frb_example git:(experiment) ✗ RUST_LOG=debug just refresh_all just gen-help cargo run --manifest-path frb_codegen/Cargo.toml -- --help > book/src/help.txt Compiling flutter_rust_bridge_codegen v1.48.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_codegen) Finished dev [unoptimized + debuginfo] target(s) in 3.01s Running `target/debug/flutter_rust_bridge_codegen --help` dart run frb_dart/bin/serve.dart --help > book/src/help.serve.txt just gen-bridge cd frb_codegen && cargo build Finished dev [unoptimized + debuginfo] target(s) in 0.06s (cd frb_example/with_flutter && flutter pub get) Running "flutter pub get" in with_flutter... 2,383ms cargo run --manifest-path frb_codegen/Cargo.toml -- -r frb_example/with_flutter/rust/src/api.rs -d frb_example/with_flutter/lib/bridge_generated.dart --dart-decl-output frb_example/with_flutter/lib/bridge_definitions.dart -c frb_example/with_flutter/ios/Runner/bridge_generated.h -c frb_example/with_flutter/macos/Runner/bridge_generated.h --dart-format-line-length 120 --wasm Finished dev [unoptimized + debuginfo] target(s) in 0.05s Running `target/debug/flutter_rust_bridge_codegen -r frb_example/with_flutter/rust/src/api.rs -d frb_example/with_flutter/lib/bridge_generated.dart --dart-decl-output frb_example/with_flutter/lib/bridge_definitions.dart -c frb_example/with_flutter/ios/Runner/bridge_generated.h -c frb_example/with_flutter/macos/Runner/bridge_generated.h --dart-format-line-length 120 --wasm` [2022-09-30T09:56:29Z DEBUG flutter_rust_bridge_codegen] configs=[Opts { rust_input_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/api.rs", dart_output_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart", dart_decl_output_path: Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart"), c_output_path: ["/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/ios/Runner/bridge_generated.h", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/macos/Runner/bridge_generated.h"], rust_crate_dir: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust", rust_output_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs", class_name: "FlutterRustBridgeExample", dart_format_line_length: 120, skip_add_mod_to_lib: false, llvm_path: ["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"], compiler_opts: "", manifest_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/Cargo.toml", dart_root: Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter"), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: true, inline_rust: false, bench_extended: true }] [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/api.rs" [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs" [2022-09-30T09:56:29Z WARN lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module web (tried /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/web.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/web/mod.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/web.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/web/mod.rs, ) [2022-09-30T09:56:29Z WARN lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/io.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/io/mod.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/io.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/io/mod.rs, ) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/off_topic_code.rs" [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(draw_mandelbrot) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(passing_complex_structs) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(returning_structs_with_boxed_fields) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_array) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_zero_copy_buffer) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_vec_u8) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_vec_of_object) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_vec_of_object) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_complex_struct) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_complex_struct) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_deliberately_return_error) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_deliberately_panic) [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::tools] Guessing toolchain the runner is run into [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=sh args="-c \"flutter\" \"--version\"" current_dir=None cmd="sh" "-c" "\"flutter\" \"--version\"" Flutter 3.3.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 18a827f393 (2 days ago) • 2022-09-28 10:03:14 -0700 Engine • revision 5c984c26eb Tools • Dart 2.18.2 • DevTools 2.15.0 [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="sh" "-c" "\"flutter\" \"--version\"" stdout= stderr= [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffi in dependencies at /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffi in dependencies at /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffigen in dev_dependencies at /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffigen in dev_dependencies at /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter [2022-09-30T09:56:30Z INFO lib_flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/api.rs", dart_output_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart", dart_decl_output_path: Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart"), c_output_path: ["/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/ios/Runner/bridge_generated.h", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/macos/Runner/bridge_generated.h"], rust_crate_dir: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust", rust_output_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs", class_name: "FlutterRustBridgeExample", dart_format_line_length: 120, skip_add_mod_to_lib: false, llvm_path: ["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"], compiler_opts: "", manifest_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/Cargo.toml", dart_root: Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter"), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: true, inline_rust: false, bench_extended: true } [2022-09-30T09:56:30Z INFO lib_flutter_rust_bridge_codegen] Phase: Parse source code to AST, then to IR [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/api.rs" [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs" [2022-09-30T09:56:30Z WARN lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module web (tried /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/web.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/web/mod.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/web.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/web/mod.rs, ) [2022-09-30T09:56:30Z WARN lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/io.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/io/mod.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/io.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/io/mod.rs, ) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/off_topic_code.rs" [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(draw_mandelbrot) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(passing_complex_structs) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(returning_structs_with_boxed_fields) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_array) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_zero_copy_buffer) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_vec_u8) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_vec_of_object) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_vec_of_object) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_complex_struct) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_complex_struct) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_deliberately_return_error) [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_deliberately_panic) [2022-09-30T09:56:30Z INFO lib_flutter_rust_bridge_codegen] Phase: Transform IR [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "Size", freezed: false }), name: IrIdent { raw: "image_size" }, is_final: true, comments: [] } [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "Point", freezed: false }), name: IrIdent { raw: "zoom_point" }, is_final: true, comments: [] } [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }), name: IrIdent { raw: "root" }, is_final: true, comments: [] } [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }), name: IrIdent { raw: "input" }, is_final: true, comments: [] } [2022-09-30T09:56:30Z INFO lib_flutter_rust_bridge_codegen] Phase: Generate Rust code [2022-09-30T09:56:30Z INFO lib_flutter_rust_bridge_codegen] Phase: Generate Dart code [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::generator::dart] distinct_input_types=[Delegate(String), Boxed(IrTypeBoxed { exist_in_real_api: false, inner: StructRef(IrTypeStructRef { name: "Point", freezed: false }) }), Boxed(IrTypeBoxed { exist_in_real_api: false, inner: StructRef(IrTypeStructRef { name: "Size", freezed: false }) }), Boxed(IrTypeBoxed { exist_in_real_api: false, inner: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }) }), Primitive(F64), Primitive(I32), GeneralList(IrTypeGeneralList { inner: StructRef(IrTypeStructRef { name: "Size", freezed: false }) }), GeneralList(IrTypeGeneralList { inner: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }) }), StructRef(IrTypeStructRef { name: "Point", freezed: false }), StructRef(IrTypeStructRef { name: "Size", freezed: false }), StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }), Primitive(U8), PrimitiveList(IrTypePrimitiveList { primitive: U8 })] [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::generator::dart] distinct_output_types=[Delegate(String), Delegate(ZeroCopyBufferVecPrimitive(U8)), Boxed(IrTypeBoxed { exist_in_real_api: true, inner: StructRef(IrTypeStructRef { name: "Point", freezed: false }) }), StructRef(IrTypeStructRef { name: "BoxedPoint", freezed: false }), Primitive(F64), Primitive(I32), GeneralList(IrTypeGeneralList { inner: StructRef(IrTypeStructRef { name: "Size", freezed: false }) }), GeneralList(IrTypeGeneralList { inner: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }) }), StructRef(IrTypeStructRef { name: "Point", freezed: false }), StructRef(IrTypeStructRef { name: "Size", freezed: false }), StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }), Primitive(U8), PrimitiveList(IrTypePrimitiveList { primitive: U8 })] [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute format_rust path=["/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.io.rs", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.web.rs"] [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=rustfmt args="/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.io.rs /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.web.rs" current_dir=None cmd="rustfmt" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.io.rs" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.web.rs" [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="rustfmt" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.io.rs" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.web.rs" stdout= stderr= [2022-09-30T09:56:30Z INFO lib_flutter_rust_bridge_codegen] Phase: Generating Dart bindings for Rust [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute cbindgen rust_crate_dir=/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust c_output_path=/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] cbindgen config: Config { header: None, includes: [], sys_includes: [ "stdbool.h", "stdint.h", "stdlib.h", ], after_includes: None, trailer: None, include_guard: None, pragma_once: false, no_includes: true, autogen_warning: None, include_version: false, namespace: None, namespaces: None, using_namespaces: None, braces: SameLine, line_length: 100, tab_width: 2, line_endings: LF, language: C, cpp_compat: false, style: Both, sort_by: None, usize_is_size_t: false, parse: ParseConfig { parse_deps: false, include: None, exclude: [], expand: ParseExpandConfig { crates: [], all_features: false, default_features: true, features: None, profile: Debug, }, clean: false, extra_bindings: [], }, export: ExportConfig { include: [ "\"wire_BoxedPoint\"", "\"wire_Point\"", "\"wire_Size\"", "\"wire_TreeNode\"", ], exclude: [], rename: {}, pre_body: {}, body: {}, prefix: None, item_types: [], renaming_overrides_prefixing: false, mangle: MangleConfig { rename_types: None, remove_underscores: false, }, }, macro_expansion: MacroExpansionConfig { bitflags: false, }, layout: LayoutConfig { packed: None, aligned_n: None, }, function: FunctionConfig { prefix: None, postfix: None, must_use: None, args: Auto, rename_args: None, swift_name_macro: None, sort_by: None, no_return: None, }, structure: StructConfig { rename_fields: None, derive_constructor: false, derive_eq: false, derive_neq: false, derive_lt: false, derive_lte: false, derive_gt: false, derive_gte: false, derive_ostream: false, associated_constants_in_body: false, must_use: None, }, enumeration: EnumConfig { rename_variants: None, rename_variant_name_fields: SnakeCase, add_sentinel: false, prefix_with_name: false, derive_helper_methods: false, derive_const_casts: false, derive_mut_casts: false, cast_assert_name: None, must_use: None, derive_tagged_enum_destructor: false, derive_tagged_enum_copy_constructor: false, derive_tagged_enum_copy_assignment: false, derive_ostream: false, enum_class: true, private_default_tagged_enum_constructor: false, }, constant: ConstantConfig { allow_static_const: true, allow_constexpr: true, sort_by: None, }, defines: {}, documentation: true, documentation_style: Auto, documentation_length: Full, pointer: PtrConfig { non_null_attribute: None, }, only_target_dependencies: false, cython: CythonConfig { header: None, cimports: {}, }, } [2022-09-30T09:56:30Z DEBUG cbindgen::bindgen::parser] Parsing crate flutter_rust_bridge_example [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::Size - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].). [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::Point - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].). [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::TreeNode - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].). [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::BoxedPoint - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].). [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::DartPort. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::DartPostCObjectFnType. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::store_dart_post_cobject. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::WireSyncReturnStruct. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_draw_mandelbrot. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_passing_complex_structs. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_returning_structs_with_boxed_fields. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_input_array. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_output_zero_copy_buffer. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_output_vec_u8. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_input_vec_of_object. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_output_vec_of_object. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_input_complex_struct. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_output_complex_struct. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_deliberately_return_error. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_deliberately_panic. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_box_autoadd_point_0. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_box_autoadd_size_0. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_box_autoadd_tree_node_0. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_list_size_0. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_list_tree_node_0. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_uint_8_list_0. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_list_size. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_list_tree_node. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_Point. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_Size. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_TreeNode. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_uint_8_list. [2022-09-30T09:56:30Z INFO cbindgen::bindgen::parser] Take flutter_rust_bridge_example::free_WireSyncReturnStruct. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::parser] Skip flutter_rust_bridge_example::A - (not `pub`). [2022-09-30T09:56:30Z WARN cbindgen::bindgen::parser] Skip flutter_rust_bridge_example::B - (not `pub`). [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z WARN cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config. [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute ffigen c_path=/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h dart_path=/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpdIiHAo llvm_path=["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"] [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] ffigen config: output: '/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpdIiHAo' name: 'FlutterRustBridgeExampleWire' description: 'generated by flutter_rust_bridge' headers: entry-points: - '/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h' include-directives: - '/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h' comments: false preamble: | // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names llvm-path: - '/opt/homebrew/opt/llvm' - '/usr/local/opt/llvm' - '/usr/lib/llvm-9' - '/usr/lib/llvm-10' - '/usr/lib/llvm-11' - '/usr/lib/llvm-12' - '/usr/lib/llvm-13' - '/usr/lib/llvm-14' - '/usr/lib/' - '/usr/lib64/' - 'C:/Program Files/llvm' - 'C:/msys64/mingw64' [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] ffigen config_file: NamedTempFile("/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpCxnKBA") [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Guessing toolchain the runner is run into [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=sh args="-c \"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpCxnKBA\"" current_dir=Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter") cmd="sh" "-c" "\"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpCxnKBA\"" Running in Directory: '/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter' Input Headers: [/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h] [SEVERE] : Header /var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h: Total errors/warnings: 180. [SEVERE] : /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:134:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [Nullability Issue] // ... Finished, Bindings generated in /var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpdIiHAo [2022-09-30T09:56:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="sh" "-c" "\"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpCxnKBA\"" stdout= stderr= [2022-09-30T09:56:32Z INFO lib_flutter_rust_bridge_codegen] Phase: Running build_runner [2022-09-30T09:56:32Z INFO lib_flutter_rust_bridge_codegen] Phase: Formatting Dart code [2022-09-30T09:56:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute format_dart path=["/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart"] line_length=120 [2022-09-30T09:56:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=sh args="-c \"dart\" \"format\" \"--line-length\" \"120\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart\"" current_dir=None cmd="sh" "-c" "\"dart\" \"format\" \"--line-length\" \"120\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart\"" Formatted /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart Formatted /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart Formatted /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart Formatted /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart Formatted 4 files (4 changed) in 0.17 seconds. [2022-09-30T09:56:33Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="sh" "-c" "\"dart\" \"format\" \"--line-length\" \"120\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart\"" stdout= stderr= [2022-09-30T09:56:33Z INFO lib_flutter_rust_bridge_codegen] Success! [2022-09-30T09:56:33Z INFO flutter_rust_bridge_codegen] Now go and use it :) cd frb_example/pure_dart/rust && cargo clean -p flutter_rust_bridge_example_single_block_test && cargo build Compiling flutter_rust_bridge_example_single_block_test v1.0.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/pure_dart/rust) Finished dev [unoptimized + debuginfo] target(s) in 6.86s cd frb_example/pure_dart_multi/rust && cargo clean -p flutter_rust_bridge_example_multi_blocks_test && cargo build Compiling flutter_rust_bridge_codegen v1.48.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_codegen) Compiling flutter_rust_bridge_example_multi_blocks_test v1.0.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/pure_dart_multi/rust) Finished dev [unoptimized + debuginfo] target(s) in 6.73s (cd frb_rust && cargo clippy -- -D warnings) Finished dev [unoptimized + debuginfo] target(s) in 0.14s (cd frb_macros && cargo clippy -- -D warnings) Finished dev [unoptimized + debuginfo] target(s) in 0.03s (cd frb_example/pure_dart/rust && cargo clippy -- -D warnings) Compiling flutter_rust_bridge_codegen v1.48.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_codegen) Compiling flutter_rust_bridge_example_single_block_test v1.0.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/pure_dart/rust) Finished dev [unoptimized + debuginfo] target(s) in 8.00s (cd frb_example/pure_dart_multi/rust && cargo clippy -- -D warnings) Compiling flutter_rust_bridge_codegen v1.48.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_codegen) Compiling flutter_rust_bridge_example_multi_blocks_test v1.0.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/pure_dart_multi/rust) Finished dev [unoptimized + debuginfo] target(s) in 6.97s (cd frb_example/with_flutter/rust && cargo clippy -- -D warnings) Checking flutter_rust_bridge_example v0.1.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust) Finished dev [unoptimized + debuginfo] target(s) in 0.28s (cd frb_example/pure_dart/dart && dart pub get) Resolving dependencies... (1.8s) _fe_analyzer_shared 48.0.0 (49.0.0 available) analyzer 5.0.0 (5.1.0 available) frontend_server_client 2.1.3 (3.0.0 available) Got dependencies! (cd frb_example/pure_dart_multi/dart && dart pub get) Resolving dependencies... (1.6s) _fe_analyzer_shared 48.0.0 (49.0.0 available) analyzer 5.0.0 (5.1.0 available) coverage 1.0.3 (1.6.1 available) frontend_server_client 2.1.3 (3.0.0 available) vm_service 7.5.0 (9.4.0 available) Got dependencies! (cd frb_example/with_flutter && flutter pub get) Running "flutter pub get" in with_flutter... 1,746ms just lint dart format --fix . Formatted frb_example/pure_dart/dart/lib/bench.dart Formatted frb_example/pure_dart/dart/lib/bridge_definitions.dart Formatted frb_example/pure_dart/dart/lib/bridge_definitions.freezed.dart Formatted frb_example/pure_dart/dart/lib/bridge_generated.dart Formatted frb_example/pure_dart/dart/lib/bridge_generated.io.dart Formatted frb_example/pure_dart/dart/lib/bridge_generated.web.dart Formatted frb_example/pure_dart/dart/lib/ffi.io.dart Formatted frb_example/pure_dart/dart/lib/main.dart Formatted frb_example/pure_dart/dart/lib/utils.dart Formatted frb_example/pure_dart_multi/dart/lib/bridge_generated_api_1.dart Formatted frb_example/pure_dart_multi/dart/lib/bridge_generated_api_2.dart Formatted frb_example/with_flutter/integration_test/main.dart Formatted frb_example/with_flutter/lib/bridge_definitions.dart Formatted frb_example/with_flutter/lib/bridge_generated.dart Formatted frb_example/with_flutter/lib/bridge_generated.io.dart Formatted frb_example/with_flutter/lib/bridge_generated.web.dart Formatted frb_example/with_flutter/lib/main.dart Formatted frb_example/with_flutter/lib/off_topic_code.dart Formatted 45 files (18 changed) in 0.60 seconds. dart format --fix -l 120 frb_example/pure_dart Formatted frb_example/pure_dart/dart/lib/bench.dart Formatted frb_example/pure_dart/dart/lib/bridge_definitions.dart Formatted frb_example/pure_dart/dart/lib/bridge_definitions.freezed.dart Formatted frb_example/pure_dart/dart/lib/bridge_generated.dart Formatted frb_example/pure_dart/dart/lib/bridge_generated.io.dart Formatted frb_example/pure_dart/dart/lib/bridge_generated.web.dart Formatted frb_example/pure_dart/dart/lib/ffi.io.dart Formatted frb_example/pure_dart/dart/lib/main.dart Formatted frb_example/pure_dart/dart/lib/utils.dart Formatted 13 files (9 changed) in 0.40 seconds. dart format --fix -l 120 frb_example/pure_dart_multi Formatted frb_example/pure_dart_multi/dart/lib/bridge_generated_api_1.dart Formatted frb_example/pure_dart_multi/dart/lib/bridge_generated_api_2.dart Formatted 3 files (2 changed) in 0.14 seconds. dart format --fix -l 120 frb_example/with_flutter Formatted frb_example/with_flutter/integration_test/main.dart Formatted frb_example/with_flutter/lib/bridge_definitions.dart Formatted frb_example/with_flutter/lib/bridge_generated.dart Formatted frb_example/with_flutter/lib/bridge_generated.io.dart Formatted frb_example/with_flutter/lib/bridge_generated.web.dart Formatted frb_example/with_flutter/lib/main.dart Formatted frb_example/with_flutter/lib/off_topic_code.dart Formatted 9 files (7 changed) in 0.21 seconds. cd frb_example/pure_dart/rust && cargo fmt cd frb_example/pure_dart_multi/rust && cargo fmt cd frb_example/with_flutter/rust && cargo fmt cd frb_codegen && cargo fmt sed -i "" -e 's/pub.flutter-io.cn/pub.dartlang.org/g' frb_example/pure_dart/dart/pubspec.lock sed -i "" -e 's/pub.flutter-io.cn/pub.dartlang.org/g' frb_example/pure_dart_multi/dart/pubspec.lock sed -i "" -e 's/pub.flutter-io.cn/pub.dartlang.org/g' frb_example/with_flutter/pubspec.lock ```

To Reproduce

Just build pure_dart example and run without web.

Expected behavior

No response

Generated binding code

click to display ```shell // AUTO GENERATED FILE, DO NOT EDIT. // Generated by `flutter_rust_bridge`@ 1.48.0. // ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names import "bridge_definitions.dart"; import 'dart:convert'; import 'dart:async'; import 'package:flutter_rust_bridge/flutter_rust_bridge.dart'; import 'package:uuid/uuid.dart'; import 'bridge_generated.dart'; export 'bridge_generated.dart'; import 'dart:developer'; import 'package:meta/meta.dart'; import 'dart:ffi' as ffi; class FlutterRustBridgeExampleSingleBlockTestPlatform extends FlutterRustBridgeBase { FlutterRustBridgeExampleSingleBlockTestPlatform(ffi.DynamicLibrary dylib) : super(FlutterRustBridgeExampleSingleBlockTestWire(dylib)); // Section: api2wire @protected int api2wire_Chrono_Duration(Duration raw) { return api2wire_i64(raw.inMicroseconds); } @protected int api2wire_Chrono_Local(DateTime raw) { return api2wire_i64(raw.microsecondsSinceEpoch); } @protected int api2wire_Chrono_Naive(DateTime raw) { return api2wire_i64(raw.microsecondsSinceEpoch); } @protected int api2wire_Chrono_Utc(DateTime raw) { return api2wire_i64(raw.microsecondsSinceEpoch); } @protected ffi.Pointer api2wire_String(String raw) { return api2wire_uint_8_list(utf8.encoder.convert(raw)); } @protected ffi.Pointer api2wire_StringList(List raw) { final ans = inner.new_StringList_0(raw.length); for (var i = 0; i < raw.length; i++) { ans.ref.ptr[i] = api2wire_String(raw[i]); } return ans; } @protected ffi.Pointer api2wire_Uuid(UuidValue raw) { return api2wire_uint_8_list(raw.toBytes()); } @protected ffi.Pointer api2wire_Uuids(List raw) { return api2wire_uint_8_list(api2wireConcatenateBytes(raw)); } @protected ffi.Pointer api2wire_ZeroCopyBuffer_Uint8List(Uint8List raw) { return api2wire_uint_8_list(raw); } // ... // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names // AUTO GENERATED FILE, DO NOT EDIT. // // Generated by `package:ffigen`. /// generated by flutter_rust_bridge class FlutterRustBridgeExampleSingleBlockTestWire implements FlutterRustBridgeWireBase { /// Holds the symbol lookup function. final ffi.Pointer Function(String symbolName) _lookup; /// The symbols are looked up in [dynamicLibrary]. FlutterRustBridgeExampleSingleBlockTestWire(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup; /// The symbols are looked up with [lookup]. FlutterRustBridgeExampleSingleBlockTestWire.fromLookup( ffi.Pointer Function(String symbolName) lookup) : _lookup = lookup; void store_dart_post_cobject( DartPostCObjectFnType ptr, ) { return _store_dart_post_cobject( ptr, ); } late final _store_dart_post_cobjectPtr = _lookup>('store_dart_post_cobject'); late final _store_dart_post_cobject = _store_dart_post_cobjectPtr.asFunction(); void wire_simple_adder( int port_, int a, int b, ) { return _wire_simple_adder( port_, a, b, ); } late final _wire_simple_adderPtr = _lookup>('wire_simple_adder'); late final _wire_simple_adder = _wire_simple_adderPtr.asFunction(); void wire_primitive_types( int port_, int my_i32, int my_i64, double my_f64, bool my_bool, ) { return _wire_primitive_types( port_, my_i32, my_i64, my_f64, my_bool, ); } late final _wire_primitive_typesPtr = _lookup>( 'wire_primitive_types'); late final _wire_primitive_types = _wire_primitive_typesPtr.asFunction(); void wire_primitive_u32( int port_, int my_u32, ) { return _wire_primitive_u32( port_, my_u32, ); } late final _wire_primitive_u32Ptr = _lookup>('wire_primitive_u32'); late final _wire_primitive_u32 = _wire_primitive_u32Ptr.asFunction(); void wire_handle_string( int port_, ffi.Pointer s, ) { return _wire_handle_string( port_, s, ); } late final _wire_handle_stringPtr = _lookup)>>('wire_handle_string'); late final _wire_handle_string = _wire_handle_stringPtr.asFunction)>(); void wire_handle_return_unit( int port_, ) { return _wire_handle_return_unit( port_, ); } late final _wire_handle_return_unitPtr = _lookup>('wire_handle_return_unit'); late final _wire_handle_return_unit = _wire_handle_return_unitPtr.asFunction(); void wire_handle_vec_u8( int port_, ffi.Pointer v, ) { return _wire_handle_vec_u8( port_, v, ); } late final _wire_handle_vec_u8Ptr = _lookup)>>('wire_handle_vec_u8'); late final _wire_handle_vec_u8 = _wire_handle_vec_u8Ptr.asFunction)>(); void wire_handle_vec_of_primitive( int port_, int n, ) { return _wire_handle_vec_of_primitive( port_, n, ); } late final _wire_handle_vec_of_primitivePtr = _lookup>('wire_handle_vec_of_primitive'); late final _wire_handle_vec_of_primitive = _wire_handle_vec_of_primitivePtr.asFunction(); void wire_handle_zero_copy_vec_of_primitive( int port_, int n, ) { return _wire_handle_zero_copy_vec_of_primitive( port_, n, ); } late final _wire_handle_zero_copy_vec_of_primitivePtr = _lookup>('wire_handle_zero_copy_vec_of_primitive'); late final _wire_handle_zero_copy_vec_of_primitive = _wire_handle_zero_copy_vec_of_primitivePtr.asFunction(); void wire_handle_struct( int port_, ffi.Pointer arg, ffi.Pointer boxed, ) { return _wire_handle_struct( port_, arg, boxed, ); } late final _wire_handle_structPtr = _lookup, ffi.Pointer)>>( 'wire_handle_struct'); late final _wire_handle_struct = _wire_handle_structPtr.asFunction, ffi.Pointer)>(); void wire_handle_newtype( int port_, ffi.Pointer arg, ) { return _wire_handle_newtype( port_, arg, ); } late final _wire_handle_newtypePtr = _lookup)>>('wire_handle_newtype'); late final _wire_handle_newtype = _wire_handle_newtypePtr.asFunction)>(); void wire_handle_list_of_struct( int port_, ffi.Pointer l, ) { return _wire_handle_list_of_struct( port_, l, ); } late final _wire_handle_list_of_structPtr = _lookup)>>( 'wire_handle_list_of_struct'); late final _wire_handle_list_of_struct = _wire_handle_list_of_structPtr.asFunction)>(); void wire_handle_string_list( int port_, ffi.Pointer names, ) { return _wire_handle_string_list( port_, names, ); } late final _wire_handle_string_listPtr = _lookup)>>( 'wire_handle_string_list'); late final _wire_handle_string_list = _wire_handle_string_listPtr.asFunction)>(); void wire_handle_complex_struct( int port_, ffi.Pointer s, ) { return _wire_handle_complex_struct( port_, s, ); } // ... typedef DartPostCObjectFnType = ffi.Pointer)>>; typedef DartPort = ffi.Int64; typedef uintptr_t = ffi.UnsignedLong; ```

OS

MacOS M1 Pro Monterey 12.4

Version of flutter_rust_bridge_codegen

latest 1.48.0

Flutter info

[✓] Flutter (Channel stable, 3.3.3, on macOS 12.4 21F79 darwin-arm, locale en-TH)
    • Flutter version 3.3.3 on channel stable at /Users/romain/Development/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18a827f393 (2 days ago), 2022-09-28 10:03:14 -0700
    • Engine revision 5c984c26eb
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/romain/Library/Android/sdk
    • Platform android-33, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Build 13F100
    • CocoaPods version 1.11.2

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.71.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.48.0

[!] Connected device
    ! No devices available

[✓] HTTP Host Availability
    • All required HTTP hosts are available

Version of clang++

Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: arm64-apple-darwin21.5.0

Version of ffigen

^6.0.1

Additional context

No response

Roms1383 commented 1 year ago

I had to shorten the logs output because it was exceeding Github limit.

fzyzcjy commented 1 year ago

what is the full output log about that "failed to lookup symbol", i.e. output of execution

Roms1383 commented 1 year ago

This output @fzyzcjy :

flutter_rust_bridge example program start (dylibPath=../../../rust/target/debug/libflutter_rust_bridge_example.dylib)
construct api
Unhandled exception:
Invalid argument(s): Failed to lookup symbol 'store_dart_post_cobject': dlsym(RTLD_DEFAULT, store_dart_post_cobject): symbol not found
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:34:70)
#1      FlutterRustBridgeExampleSingleBlockTestWire._store_dart_post_cobjectPtr (package:flutter_rust_bridge_example/bridge_generated.io.dart:1573:76)
#2      FlutterRustBridgeExampleSingleBlockTestWire._store_dart_post_cobjectPtr (package:flutter_rust_bridge_example/bridge_generated.io.dart)
#3      FlutterRustBridgeExampleSingleBlockTestWire._store_dart_post_cobject (package:flutter_rust_bridge_example/bridge_generated.io.dart:1574:41)
#4      FlutterRustBridgeExampleSingleBlockTestWire._store_dart_post_cobject (package:flutter_rust_bridge_example/bridge_generated.io.dart)
#5      FlutterRustBridgeExampleSingleBlockTestWire.store_dart_post_cobject (package:flutter_rust_bridge_example/bridge_generated.io.dart:1567:12)
#6      StoreDartPostCObjectExt.storeDartPostCObject (package:flutter_rust_bridge/src/ffi/io.dart:16:5)
#7      FlutterRustBridgeBase._setUpRustToDartComm (package:flutter_rust_bridge/src/basic.dart:39:11)
#8      new FlutterRustBridgeBase (package:flutter_rust_bridge/src/basic.dart:22:5)
#9      new FlutterRustBridgeExampleSingleBlockTestPlatform (package:flutter_rust_bridge_example/bridge_generated.io.dart:19:9)
#10     new FlutterRustBridgeExampleSingleBlockTestImpl (package:flutter_rust_bridge_example/bridge_generated.dart:16:55)
#11     initializeExternalLibrary (package:flutter_rust_bridge_example/ffi.io.dart:8:10)
#12     main (package:flutter_rust_bridge_example/main.dart:17:15)
#13     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#14     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
Roms1383 commented 1 year ago

I got the path messed up in my previous output, so I fixed it (dylibPath=../../../target/debug/libflutter_rust_bridge_example.dylib)

So I added a safety net to make sure in main.dart e.g. :

if (!File(dylibPath).existsSync()) {
    throw Exception('$dylibPath does not exist');
  }

But the error persists ! 😅

fzyzcjy commented 1 year ago

Use some tools to see what is inside that dylib file.

For a linux .so file, we have nm and objdump etc. For macos IIRC there are similar things.

Then, we can know whether the symbol is really in the dylib, and if yes, what is the signature of that symbol.

Roms1383 commented 1 year ago

I noticed that the dummy codegen doesn't appear in the bridge_generated.* files, is this important ? It seems related :

pub const DUMMY_WIRE_CODE_FOR_BINDGEN: &str = r#"
    // ----------- DUMMY CODE FOR BINDGEN ----------

    // copied from: allo-isolate
    pub type DartPort = i64;
    pub type DartPostCObjectFnType = unsafe extern "C" fn(port_id: DartPort, message: *mut std::ffi::c_void) -> bool;
    #[no_mangle] pub unsafe extern "C" fn store_dart_post_cobject(ptr: DartPostCObjectFnType) { panic!("dummy code") }

    // copied from: frb_rust::support.rs
    #[repr(C)]
    pub struct WireSyncReturnStruct {
        pub ptr: *mut u8,
        pub len: i32,
        pub success: bool,
    }

    // ---------------------------------------------
    "#;
fzyzcjy commented 1 year ago

IIRC that is created and then removed later? forget the details

Roms1383 commented 1 year ago

I'm sorry I actually don't know what is IIRC (answers on Google seemed unrelated, even with keywords). People recommended otool on macos but ... I don't even know what I'm supposed to look for ^^'

Roms1383 commented 1 year ago

Ah wait, here you go I guess nm -gU target/debug/libflutter_rust_bridge_example.dylib.

click to display ```sh 00000000000688b0 T _free_WireSyncReturnStruct 0000000000129bf0 T _free_zero_copy_buffer_f32 0000000000129c68 T _free_zero_copy_buffer_f64 0000000000129920 T _free_zero_copy_buffer_i16 0000000000129a10 T _free_zero_copy_buffer_i32 0000000000129b00 T _free_zero_copy_buffer_i64 0000000000129830 T _free_zero_copy_buffer_i8 0000000000129998 T _free_zero_copy_buffer_u16 0000000000129a88 T _free_zero_copy_buffer_u32 0000000000129b78 T _free_zero_copy_buffer_u64 00000000001298a8 T _free_zero_copy_buffer_u8 0000000000067ef4 T _inflate_Distance_Map 00000000000683d4 T _inflate_KitchenSink_Buffer 0000000000068438 T _inflate_KitchenSink_Enums 00000000000682d0 T _inflate_KitchenSink_Nested 000000000006834c T _inflate_KitchenSink_Optional 000000000006824c T _inflate_KitchenSink_Primitives 000000000006853c T _inflate_Measure_Distance 00000000000684d8 T _inflate_Measure_Speed 00000000000687f8 T _inflate_Speed_GPS 0000000000064420 T _new_StringList_0 0000000000064488 T _new_box_application_env_0 00000000000644c8 T _new_box_autoadd_application_settings_0 0000000000064500 T _new_box_autoadd_attribute_0 0000000000064540 T _new_box_autoadd_bool_0 0000000000064578 T _new_box_autoadd_concatenate_with_0 00000000000645b8 T _new_box_autoadd_customized_0 00000000000645f8 T _new_box_autoadd_exotic_optionals_0 0000000000064630 T _new_box_autoadd_f64_0 000000000006465c T _new_box_autoadd_feature_chrono_0 0000000000064694 T _new_box_autoadd_feature_uuid_0 00000000000646d4 T _new_box_autoadd_i32_0 0000000000064700 T _new_box_autoadd_i64_0 000000000006472c T _new_box_autoadd_kitchen_sink_0 000000000006476c T _new_box_autoadd_measure_0 00000000000647ac T _new_box_autoadd_my_size_0 00000000000647ec T _new_box_autoadd_my_struct_0 000000000006482c T _new_box_autoadd_my_tree_node_0 0000000000064864 T _new_box_autoadd_new_type_int_0 00000000000648a4 T _new_box_autoadd_note_0 00000000000648e4 T _new_box_autoadd_numbers_0 0000000000064924 T _new_box_autoadd_sequences_0 0000000000064964 T _new_box_autoadd_sum_with_0 00000000000649a4 T _new_box_autoadd_user_id_0 00000000000649e4 T _new_box_bool_0 0000000000064a1c T _new_box_distance_0 0000000000064a5c T _new_box_exotic_optionals_0 0000000000064a94 T _new_box_f64_0 0000000000064ac0 T _new_box_i32_0 0000000000064aec T _new_box_i64_0 0000000000064b18 T _new_box_i8_0 0000000000064b44 T _new_box_kitchen_sink_0 0000000000064b84 T _new_box_my_size_0 0000000000064bc4 T _new_box_speed_0 0000000000064c04 T _new_box_u8_0 0000000000064c30 T _new_box_weekdays_0 0000000000064c5c T _new_float_32_list_0 0000000000064cc4 T _new_float_64_list_0 0000000000064d2c T _new_int_32_list_0 0000000000064d94 T _new_int_8_list_0 0000000000064dfc T _new_list_application_env_var_0 0000000000064e70 T _new_list_attribute_0 0000000000064ee0 T _new_list_my_size_0 0000000000064f50 T _new_list_my_tree_node_0 0000000000064fb8 T _new_list_opt_box_autoadd_attribute_0 0000000000065020 T _new_uint_8_list_0 0000000000128b5c T _store_dart_post_cobject 00000000000640e8 T _wire_call_new_module_system 00000000000640c4 T _wire_call_old_module_system 0000000000063f98 T _wire_close_event_listener 0000000000064308 T _wire_concatenate__method__ConcatenateWith 000000000006433c T _wire_concatenate_static__static_method__ConcatenateWith 0000000000063fbc T _wire_create_event 0000000000064158 T _wire_datetime_local 0000000000064130 T _wire_datetime_utc 00000000000641a8 T _wire_duration 0000000000063e80 T _wire_first_number 0000000000063eac T _wire_first_sequence 0000000000063db4 T _wire_get_app_settings 0000000000063ed8 T _wire_get_array 0000000000063efc T _wire_get_complex_array 0000000000063e04 T _wire_get_message 0000000000064074 T _wire_get_sum_struct 0000000000063f20 T _wire_get_usize 000000000006410c T _wire_handle_big_buffers 0000000000063834 T _wire_handle_complex_struct 0000000000063d08 T _wire_handle_customized_struct 0000000000063ce0 T _wire_handle_enum_parameter 0000000000063d34 T _wire_handle_enum_struct 0000000000063c00 T _wire_handle_increment_boxed_optional 00000000000637dc T _wire_handle_list_of_struct 0000000000064254 T _wire_handle_nested_uuids 00000000000637b0 T _wire_handle_newtype 0000000000063c2c T _wire_handle_option_box_arguments 0000000000063bd4 T _wire_handle_optional_increment 0000000000063b7c T _wire_handle_optional_return 0000000000063ba8 T _wire_handle_optional_struct 0000000000063cb4 T _wire_handle_return_enum 00000000000636dc T _wire_handle_return_unit 00000000000643d0 T _wire_handle_some_static_stream_sink__static_method__ConcatenateWith 00000000000643fc T _wire_handle_some_static_stream_sink_single_arg__static_method__ConcatenateWith 0000000000064370 T _wire_handle_some_stream_sink__method__ConcatenateWith 00000000000643a4 T _wire_handle_some_stream_sink_at_1__method__ConcatenateWith 0000000000063ae4 T _wire_handle_stream 0000000000063b10 T _wire_handle_stream_of_struct 0000000000063ff0 T _wire_handle_stream_sink_at_1 000000000006401c T _wire_handle_stream_sink_at_2 0000000000064048 T _wire_handle_stream_sink_at_3 00000000000636b0 T _wire_handle_string 0000000000063808 T _wire_handle_string_list 000000000006377c T _wire_handle_struct 0000000000063894 T _wire_handle_sync_bool 0000000000063a50 T _wire_handle_sync_f32 0000000000063a80 T _wire_handle_sync_f64 00000000000639c0 T _wire_handle_sync_i16 00000000000639f0 T _wire_handle_sync_i32 0000000000063a20 T _wire_handle_sync_i64 0000000000063990 T _wire_handle_sync_i8 0000000000063860 T _wire_handle_sync_return 0000000000063ab0 T _wire_handle_sync_string 0000000000063900 T _wire_handle_sync_u16 0000000000063930 T _wire_handle_sync_u32 0000000000063960 T _wire_handle_sync_u64 00000000000638d0 T _wire_handle_sync_u8 00000000000641fc T _wire_handle_uuid 0000000000064228 T _wire_handle_uuids 000000000006372c T _wire_handle_vec_of_primitive 0000000000063700 T _wire_handle_vec_u8 0000000000063754 T _wire_handle_zero_copy_vec_of_primitive 00000000000641d0 T _wire_how_long_does_it_take 0000000000063dd8 T _wire_is_app_embedded 0000000000064098 T _wire_multiply_by_ten 0000000000064180 T _wire_naivedatetime 00000000000642dc T _wire_new__static_method__ConcatenateWith 0000000000063f48 T _wire_next_user_id 0000000000063648 T _wire_primitive_types 0000000000063688 T _wire_primitive_u32 0000000000063c88 T _wire_print_note 0000000000063f74 T _wire_register_event_listener 0000000000063e28 T _wire_repeat_number 0000000000063e54 T _wire_repeat_sequence 0000000000063b34 T _wire_return_err 0000000000063b58 T _wire_return_panic 0000000000064280 T _wire_send_i64 000000000006361c T _wire_simple_adder 00000000000642a8 T _wire_sum__method__SumWith 0000000000063d8c T _wire_use_imported_enum 0000000000063d60 T _wire_use_imported_struct ```

Apparently the symbol is present : 0000000000128b5c T _store_dart_post_cobject

fzyzcjy commented 1 year ago

image

;)

fzyzcjy commented 1 year ago

the weird thing is:

  void store_dart_post_cobject(
    DartPostCObjectFnType ptr,
  ) {
    return _store_dart_post_cobject(
      ptr,
    );
  }

  late final _store_dart_post_cobjectPtr =
      _lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>('store_dart_post_cobject');
  late final _store_dart_post_cobject = _store_dart_post_cobjectPtr.asFunction<void Function(DartPostCObjectFnType)>();

typedef DartPostCObjectFnType = ffi.Pointer<ffi.NativeFunction<ffi.Bool Function(DartPort, ffi.Pointer<ffi.Void>)>>;
typedef DartPort = ffi.Int64;

that type looks correct to me

fzyzcjy commented 1 year ago

so maybe do some reduction?

for example, write some dart code:

  1. is the symbol storedartpostcobject provided? https://api.dart.dev/stable/2.18.2/dart-ffi/DynamicLibrary/providesSymbol.html
  2. can we lookup another symbol, e.g. _wire_handle_sync_i8?
  3. can we lookup symbols in other dylib files?
Roms1383 commented 1 year ago

Found it :

If I replace :

DynamicLibrary.executable() with DynamicLibrary.open(path) (like in non-IOS/MacOS) in frb_example/pure_dart/dart/lib/ffi.io.dart it works.

FlutterRustBridgeExampleSingleBlockTestImpl initializeExternalLibrary(String path) {
  return FlutterRustBridgeExampleSingleBlockTestImpl(
    Platform.isMacOS || Platform.isIOS ? DynamicLibrary.executable() : DynamicLibrary.open(path),
  );
}

I have no idea why though.

Roms1383 commented 1 year ago

Is this MacOS ARM specific ? or is DynamicLibrary.executable() wrong for all iOS/MacOS ?

fzyzcjy commented 1 year ago

weird... the lib works well for me, in macos intel

Roms1383 commented 1 year ago

Should we add another check based on Platform.operatingSystemVersion to differentiate between MacOS Intel and MacOS ARM ? I checked already there's no mention of M1 in e.g. Platform.isIOS and the other methods.

Roms1383 commented 1 year ago

Here's what I get on my machine : Version 12.4 (Build 21F79)

Screen Shot 2565-09-30 at 19 44 20
fzyzcjy commented 1 year ago

really not sure what is happening here. maybe not a problem between m1 and intel, but problem elsewhere in the toolchain config?

maybe add this to doc, telling people to try changing what you have changed.

and also add a link from doc to here. if many people see same problem we will know whether it is M1 or sth else causes it

Roms1383 commented 1 year ago

I might be a bit slow, but I'll try to do it asap 👌

Roms1383 commented 1 year ago

I'm gonna include a quick fix in the coming PR #755 to remediate : By changing ffi.io.dart files from:

e.g. flutter_rust_bridge/frb_example/pure_dart/dart/lib/ffi.io.dart

// ...
FlutterRustBridgeExampleSingleBlockTestImpl initializeExternalLibrary(String path) {
  return FlutterRustBridgeExampleSingleBlockTestImpl(
    Platform.isMacOS || Platform.isIOS ? DynamicLibrary.executable() : DynamicLibrary.open(path),
  );
}

To:

// ...
FlutterRustBridgeExampleSingleBlockTestImpl initializeExternalLibrary(String path) {
  return FlutterRustBridgeExampleSingleBlockTestImpl(
    (Platform.isMacOS || Platform.isIOS) &&
              !const bool.fromEnvironment('SILICON', defaultValue: false)
          ? DynamicLibrary.executable()
          : DynamicLibrary.open(path),
  );
}

And updating related just commands to accept extra CLI arg(s) + pipe it to Dart run command, one can just append --define=SILICON=true to his/her commands to workaround this issue until Dart provide a way to clearly differentiate a MacOS Silicon from an older generation MacOS and be handled automatically by FRB.

fzyzcjy commented 1 year ago

@Roms1383 LGTM, just a few small points

  1. could you please make it a separate PR, so it is easier to manage :)
  2. maybe change it to DYNAMIC_LIBRARY_SOURCE which is an enum (string)
Roms1383 commented 1 year ago

could you please make it a separate PR, so it is easier to manage :)

That's a bit tedious, but can if you want.

maybe change it to DYNAMIC_LIBRARY_SOURCE which is an enum (string)

Hmmm why DYNAMIC_LIBRARY_SOURCE ? SILICON seems more explicit, doesn't it ?

fzyzcjy commented 1 year ago

That's a bit tedious, but can if you want.

According to flutter repo suggestion, even one PR for one very tiny change :)

Hmmm why DYNAMIC_LIBRARY_SOURCE ? SILICON seems more explicit, doesn't it ?

Usage: --define DYNAMIC_LIBRARY_SOURCE=executable, --define DYNAMIC_LIBRARY_SOURCE=path, etc

Roms1383 commented 1 year ago

@fzyzcjy am I allowed to upgrade Dart SDK minimum requirement from 2.14.0 to 2.17.0 ? That would allow using enhanced-enums feature from Dart, and be able to write cool stuff like e.g. :

enum DylibSourceKind {
    process,
    executable,
    open;
    static DylibSourceKind? fromEnvironment(String arg) {
      // ...
   }
}
fzyzcjy commented 1 year ago

I think so, especially we have made min rust be 1.64.0.

Desdaemon commented 1 year ago

Don't have an Intel Mac to test this, but I suspect DynamicLibrary.executable for pure_dart MacOS might be bugged code. That method points to the dart executable as the dylib source, so understandably it won't have our symbols. If this is true, it wouldn't really matter if it was on Apple Silicon or not. Also I don't think we're running unit tests on iOS so the entire conditional dylib loading can be omitted.

fzyzcjy commented 1 year ago

Interestingly, as reported in https://github.com/fzyzcjy/flutter_rust_bridge/issues/772#issuecomment-1272678708, seems another M1 person sees this problem

kingfisherphuoc commented 1 year ago

I had the same issue on a Flutter project. It's solved by this:

final Native api = NativeImpl(
    ((io.Platform.isIOS || io.Platform.isMacOS) && !const bool.fromEnvironment('SILICON', defaultValue: false))
        ? DynamicLibrary.executable()
        : DynamicLibrary.open(_dylib));
justinmoon commented 1 year ago

I ran into this problem trying to write a dart test of my rust code on an m1 mac.

Here I forked the template and added one tiny unittest. When I run flutter test test/bridge_test.dart I get the Failed to lookup symbol 'store_dart_post_cobject': dlsym(RTLD_DEFAULT, store_dart_post_cobject): symbol not found error.

The SILICON environment variable mentioned above doesn't work and gives this error:

  Invalid argument(s): Failed to load dynamic library 'libbridge.so': dlopen(libbridge.so, 0x0001): tried: '/Users/justin/bin/flutter/bin/cache/artifacts/engine/darwin-x64/./libbridge.so' (no such file), '/Users/justin/bin/flutter/bin/cache/artifacts/engine/darwin-x64/../../../libbridge.so' (no such file), '/Users/justin/bin/flutter/bin/cache/artifacts/engine/darwin-x64/Frameworks/libbridge.so' (no such file), '/Users/justin/bin/flutter/bin/cache/artifacts/engine/darwin-x64/./libbridge.so' (no such file), '/Users/justin/bin/flutter/bin/cache/artifacts/engine/darwin-x64/../../../libbridge.so' (no such file), '/Users/justin/bin/flutter/bin/cache/artifacts/engine/darwin-x64/Frameworks/libbridge.so' (no such file), 'libbridge.so' (no such file), '/usr/lib/libbridge.so' (no such file), '/Users/justin/fedimint/mobile2/apps/fedi/libbridge.so' (no such file)
fzyzcjy commented 1 year ago

The SILICON environment variable

Could you please check whether it is in master branch. If not, you need to modify code as suggested.

Roms1383 commented 1 year ago

@fzyzcjy @justinmoon the SILICON workaround hasn't been merged yet, please add it manually for now.

fzyzcjy commented 1 year ago

@Roms1383 Btw for your SILICON pr - given all these reports, I now totally agree it is named "silicon" and just do it the simple way.

justinmoon commented 1 year ago

If I just do the following in the template, it still doesn't work with the Failed to load dynamic library 'libbridge.so' error. So I'm not sure the SILICON workaround will work for me, because this is what it attempts to do right?

final Native api = NativeImpl(DynamicLibrary.open(_dylib));
SAGARSURI commented 1 year ago

I am using an M1 pro machine. I am trying to run a simple rust program on my android emulator. I am getting the following runtime error:

Invalid argument(s): Failed to lookup symbol 'store_dart_post_cobject': undefined symbol: store_dart_post_cobject

My bridge_generated.dart:

// AUTO GENERATED FILE, DO NOT EDIT.
// Generated by `flutter_rust_bridge`@ 1.49.0.
// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names

import 'dart:convert';
import 'dart:async';
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';

import 'package:meta/meta.dart';
import 'package:meta/meta.dart';
import 'dart:ffi' as ffi;

abstract class AdderFfi {
  Future<int> add({required int a, required int b, dynamic hint});

  FlutterRustBridgeTaskConstMeta get kAddConstMeta;
}

class AdderFfiImpl implements AdderFfi {
  final AdderFfiPlatform _platform;
  factory AdderFfiImpl(ExternalLibrary dylib) =>
      AdderFfiImpl.raw(AdderFfiPlatform(dylib));

  /// Only valid on web/WASM platforms.
  factory AdderFfiImpl.wasm(FutureOr<WasmModule> module) =>
      AdderFfiImpl(module as ExternalLibrary);
  AdderFfiImpl.raw(this._platform);
  Future<int> add({required int a, required int b, dynamic hint}) =>
      _platform.executeNormal(FlutterRustBridgeTask(
        callFfi: (port_) => _platform.inner.wire_add(
            port_, _platform.api2wire_i64(a), _platform.api2wire_i64(b)),
        parseSuccessData: _wire2api_i64,
        constMeta: kAddConstMeta,
        argValues: [a, b],
        hint: hint,
      ));

  FlutterRustBridgeTaskConstMeta get kAddConstMeta =>
      const FlutterRustBridgeTaskConstMeta(
        debugName: "add",
        argNames: ["a", "b"],
      );

// Section: wire2api

  int _wire2api_i64(dynamic raw) {
    return castInt(raw);
  }
}

// Section: api2wire

class AdderFfiPlatform extends FlutterRustBridgeBase<AdderFfiWire> {
  AdderFfiPlatform(ffi.DynamicLibrary dylib) : super(AdderFfiWire(dylib));
// Section: api2wire

  @protected
  int api2wire_i64(int raw) {
    return raw;
  }
// Section: api_fill_to_wire

}

// ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.

/// generated by flutter_rust_bridge
class AdderFfiWire implements FlutterRustBridgeWireBase {
  /// Holds the symbol lookup function.
  final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
      _lookup;

  /// The symbols are looked up in [dynamicLibrary].
  AdderFfiWire(ffi.DynamicLibrary dynamicLibrary)
      : _lookup = dynamicLibrary.lookup;

  /// The symbols are looked up with [lookup].
  AdderFfiWire.fromLookup(
      ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
          lookup)
      : _lookup = lookup;

  void store_dart_post_cobject(
    DartPostCObjectFnType ptr,
  ) {
    return _store_dart_post_cobject(
      ptr,
    );
  }

  late final _store_dart_post_cobjectPtr =
      _lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>(
          'store_dart_post_cobject');
  late final _store_dart_post_cobject = _store_dart_post_cobjectPtr
      .asFunction<void Function(DartPostCObjectFnType)>();

  void wire_add(
    int port_,
    int a,
    int b,
  ) {
    return _wire_add(
      port_,
      a,
      b,
    );
  }

  late final _wire_addPtr = _lookup<
      ffi.NativeFunction<
          ffi.Void Function(ffi.Int64, ffi.Int64, ffi.Int64)>>('wire_add');
  late final _wire_add =
      _wire_addPtr.asFunction<void Function(int, int, int)>();

  void free_WireSyncReturnStruct(
    WireSyncReturnStruct val,
  ) {
    return _free_WireSyncReturnStruct(
      val,
    );
  }

  late final _free_WireSyncReturnStructPtr =
      _lookup<ffi.NativeFunction<ffi.Void Function(WireSyncReturnStruct)>>(
          'free_WireSyncReturnStruct');
  late final _free_WireSyncReturnStruct = _free_WireSyncReturnStructPtr
      .asFunction<void Function(WireSyncReturnStruct)>();
}

typedef DartPostCObjectFnType = ffi.Pointer<
    ffi.NativeFunction<ffi.Bool Function(DartPort, ffi.Pointer<ffi.Void>)>>;
typedef DartPort = ffi.Int64;
fzyzcjy commented 1 year ago

@SAGARSURI please create a new issue with full info. there can be many reasons of this

SAGARSURI commented 1 year ago

Sure I will. Thanks.

github-actions[bot] commented 1 year ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.