fzyzcjy / flutter_rust_bridge

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

[Bug] Unable to generate correct code on Windows #830

Closed SULAPIS closed 1 year ago

SULAPIS commented 1 year ago

Describe the bug

Hi! I downloaded the template according to the tutorial [Generating code] , but the code generated after running just is different from the original and get two errors. image image image

Codegen logs with RUST_LOG=debug environment variable

$ RUST_LOG=debug just
flutter pub get
Running "flutter pub get" in flutter_rust_bridge_template...      2,220ms
flutter_rust_bridge_codegen --rust-input native/src/api.rs --dart-output lib/bridge_generated.dart --c-output ios/Runner/bridge_generated.h --c-output macos/Runner/bridge_generated.h --dart-decl-output lib/bridge_definitions.dart --wasm
[2022-11-07T14:36:37Z DEBUG flutter_rust_bridge_codegen] configs=[Opts { rust_input_path: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src/api.rs", dart_output_path: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_generated.dart", dart_decl_output_path: Some("D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_definitions.dart"), c_output_path: ["D:\\Practice\\flutter\\flutter_rust_bridge_template\\ios/Runner/bridge_generated.h", "D:\\Practice\\flutter\\flutter_rust_bridge_template\\macos/Runner/bridge_generated.h"], rust_crate_dir: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native", rust_output_path: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.rs", class_name: "Native", dart_format_line_length: 80, 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"], llvm_compiler_opts: "", manifest_path: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native\\Cargo.toml", dart_root: Some("D:\\Practice\\flutter\\flutter_rust_bridge_template"), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: true, inline_rust: false }]
[2022-11-07T14:36:38Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "\\\\?\\D:\\Practice\\flutter\\flutter_rust_bridge_template\\native\\src\\api.rs"
[2022-11-07T14:36:38Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "\\\\?\\D:\\Practice\\flutter\\flutter_rust_bridge_template\\native\\src\\bridge_generated.rs"
[2022-11-07T14:36:38Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module web (tried \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\web.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\web\mod.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\bridge_generated\web.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\bridge_generated\web\mod.rs, )
[2022-11-07T14:36:38Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\io.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\io\mod.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\bridge_generated\io.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\bridge_generated\io\mod.rs, )
[2022-11-07T14:36:38Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(platform)
[2022-11-07T14:36:38Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(rust_release_mode)
[2022-11-07T14:36:38Z DEBUG lib_flutter_rust_bridge_codegen::tools] Guessing toolchain the runner is run into
[2022-11-07T14:36:38Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=powershell args="-noprofile -command & \"flutter\" \"--version\"" current_dir=None cmd="powershell" "-noprofile" "-command" "& \"flutter\" \"--version\""
Flutter 3.0.5 • channel unknown • unknown source
Framework • revision f1875d570e (4 months ago) • 2022-07-13 11:24:16 -0700
Engine • revision e85ea0e79c
Tools • Dart 2.17.6 • DevTools 2.12.2
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="powershell" "-noprofile" "-command" "& \"flutter\" \"--version\"" stdout= stderr=
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffi in dependencies at D:\Practice\flutter\flutter_rust_bridge_template
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffi in dependencies at D:\Practice\flutter\flutter_rust_bridge_template
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffigen in dev_dependencies at D:\Practice\flutter\flutter_rust_bridge_template
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffigen in dev_dependencies at D:\Practice\flutter\flutter_rust_bridge_template
[2022-11-07T14:36:44Z INFO  lib_flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src/api.rs", dart_output_path: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_generated.dart", dart_decl_output_path: Some("D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_definitions.dart"), c_output_path: ["D:\\Practice\\flutter\\flutter_rust_bridge_template\\ios/Runner/bridge_generated.h", "D:\\Practice\\flutter\\flutter_rust_bridge_template\\macos/Runner/bridge_generated.h"], rust_crate_dir: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native", rust_output_path: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.rs", class_name: "Native", dart_format_line_length: 80, 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"], llvm_compiler_opts: "", manifest_path: "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native\\Cargo.toml", dart_root: Some("D:\\Practice\\flutter\\flutter_rust_bridge_template"), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: true, inline_rust: false }
[2022-11-07T14:36:44Z INFO  lib_flutter_rust_bridge_codegen] Phase: Parse source code to AST, then to IR
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "\\\\?\\D:\\Practice\\flutter\\flutter_rust_bridge_template\\native\\src\\api.rs"
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "\\\\?\\D:\\Practice\\flutter\\flutter_rust_bridge_template\\native\\src\\bridge_generated.rs"
[2022-11-07T14:36:44Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module web (tried \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\web.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\web\mod.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\bridge_generated\web.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\bridge_generated\web\mod.rs, )
[2022-11-07T14:36:44Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\io.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\io\mod.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\bridge_generated\io.rs, \\?\D:\Practice\flutter\flutter_rust_bridge_template\native\src\bridge_generated\io\mod.rs, )
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(platform)
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(rust_release_mode)
[2022-11-07T14:36:44Z INFO  lib_flutter_rust_bridge_codegen] Phase: Transform IR
[2022-11-07T14:36:44Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generate Rust code
[2022-11-07T14:36:44Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generate Dart code
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::generator::dart] distinct_input_types=[]
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::generator::dart] distinct_output_types=[Primitive(Bool), Primitive(I32), Delegate(PrimitiveEnum { ir: IrTypeEnumRef { name: "Platform" }, repr: I32 })]
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute format_rust path=["D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.rs", "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.io.rs", "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.web.rs"]
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=rustfmt args="D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.rs D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.io.rs D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.web.rs" current_dir=None cmd="rustfmt" "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.rs" "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.io.rs" "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.web.rs"
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="rustfmt" "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.rs" "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.io.rs" "D:\\Practice\\flutter\\flutter_rust_bridge_template\\native/src\\bridge_generated.web.rs" stdout= stderr=
[2022-11-07T14:36:44Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generating Dart bindings for Rust
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute cbindgen rust_crate_dir=D:\Practice\flutter\flutter_rust_bridge_template\native c_output_path=C:\Users\P\AppData\Local\Temp\.tmpQkjiDZ.h
[2022-11-07T14:36:44Z 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: [],
            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-11-07T14:36:44Z DEBUG cbindgen::bindgen::parser] Parsing crate native
[2022-11-07T14:36:44Z INFO  cbindgen::bindgen::parser] Take native::Platform - opaque (Enum is not marked with a valid #[repr(prim)] or #[repr(C)].).
[2022-11-07T14:36:44Z INFO  cbindgen::bindgen::parser] Take native::DartPort.
[2022-11-07T14:36:44Z INFO  cbindgen::bindgen::parser] Take native::DartPostCObjectFnType.
[2022-11-07T14:36:44Z INFO  cbindgen::bindgen::parser] Take native::store_dart_post_cobject.
[2022-11-07T14:36:44Z INFO  cbindgen::bindgen::parser] Take native::WireSyncReturnStruct.
[2022-11-07T14:36:44Z INFO  cbindgen::bindgen::parser] Take native::wire_platform.
[2022-11-07T14:36:44Z INFO  cbindgen::bindgen::parser] Take native::wire_rust_release_mode.
[2022-11-07T14:36:44Z INFO  cbindgen::bindgen::parser] Take native::free_WireSyncReturnStruct.
[2022-11-07T14:36:44Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
[2022-11-07T14:36:44Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
[2022-11-07T14:36:44Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
[2022-11-07T14:36:44Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
[2022-11-07T14:36:44Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
[2022-11-07T14:36:44Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute ffigen c_path=C:\Users\P\AppData\Local\Temp\.tmpQkjiDZ.h dart_path=C:\Users\P\AppData\Local\Temp\.tmpAEYX4U 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-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] ffigen config:
            output: 'C:\Users\P\AppData\Local\Temp\.tmpAEYX4U'
            name: 'NativeWire'
            description: 'generated by flutter_rust_bridge'
            headers:
              entry-points:
                - 'C:\Users\P\AppData\Local\Temp\.tmpQkjiDZ.h'
              include-directives:
                - 'C:\Users\P\AppData\Local\Temp\.tmpQkjiDZ.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-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] ffigen config_file: NamedTempFile("C:\\Users\\P\\AppData\\Local\\Temp\\.tmplrvKcK")
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::tools] Guessing toolchain the runner is run into
[2022-11-07T14:36:44Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=powershell args="-noprofile -command & \"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"C:\\\\Users\\\\P\\\\AppData\\\\Local\\\\Temp\\\\.tmplrvKcK\"" current_dir=Some("D:\\Practice\\flutter\\flutter_rust_bridge_template") cmd="powershell" "-noprofile" "-command" "& \"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"C:\\\\Users\\\\P\\\\AppData\\\\Local\\\\Temp\\\\.tmplrvKcK\""
Running in Directory: 'D:\Practice\flutter\flutter_rust_bridge_template'
Input Headers: [C:\Users\P\AppData\Local\Temp\.tmpQkjiDZ.h]
[SEVERE] : Header C:\Users\P\AppData\Local\Temp\.tmpQkjiDZ.h: Total errors/warnings: 1.
[SEVERE] :     C:\Users\P\AppData\Local\Temp\.tmpQkjiDZ.h:1:10: fatal error: 'stdbool.h' file not found [Lexical or Preprocessor Issue]
Finished, Bindings generated in C:\Users\P\AppData\Local\Temp\.tmpAEYX4U
[2022-11-07T14:36:49Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="powershell" "-noprofile" "-command" "& \"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"C:\\\\Users\\\\P\\\\AppData\\\\Local\\\\Temp\\\\.tmplrvKcK\"" stdout= stderr=
[2022-11-07T14:36:49Z INFO  lib_flutter_rust_bridge_codegen] Phase: Running build_runner
[2022-11-07T14:36:49Z INFO  lib_flutter_rust_bridge_codegen] Phase: Formatting Dart code
[2022-11-07T14:36:49Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute format_dart path=["D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_generated.dart", "D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_definitions.dart", "D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_generated.web.dart", "D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_generated.io.dart"] line_length=80
[2022-11-07T14:36:49Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=powershell args="-noprofile -command & \"dart\" \"format\" \"--line-length\" \"80\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_definitions.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.web.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.io.dart\"" current_dir=None cmd="powershell" "-noprofile" "-command" "& \"dart\" \"format\" \"--line-length\" \"80\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_definitions.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.web.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.io.dart\""
Formatted D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_generated.dart
Formatted D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_definitions.dart
Formatted D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_generated.web.dart
Formatted D:\\Practice\\flutter\\flutter_rust_bridge_template\\lib/bridge_generated.io.dart
Formatted 4 files (4 changed) in 0.29 seconds.
[2022-11-07T14:36:50Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="powershell" "-noprofile" "-command" "& \"dart\" \"format\" \"--line-length\" \"80\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_definitions.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.web.dart\" \"D:\\\\Practice\\\\flutter\\\\flutter_rust_bridge_template\\\\lib/bridge_generated.io.dart\"" stdout= stderr=
[2022-11-07T14:36:50Z INFO  lib_flutter_rust_bridge_codegen] Success!
[2022-11-07T14:36:50Z INFO  flutter_rust_bridge_codegen] Now go and use it :)
flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 434ms

[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 62ms

[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 562ms

[INFO] Running build...
[INFO] Running build completed, took 13ms

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 33ms

[INFO] Succeeded after 59ms with 0 outputs (0 actions)

cd native && cargo fmt
dart format .
Formatted 8 files (0 changed) in 0.42 seconds.

To Reproduce

git clone https://github.com/Desdaemon/flutter_rust_bridge_template.git cd .\flutter_rust_bridge_template\ flutter pub add -d build_runner flutter pub add -d freezed flutter pub add freezed_annotation add flutter pub run build_runner build to justfile just

Expected behavior

Same as the original generated code of flutter_rust_bridge_template

Generated binding code

No response

OS

Windows 11

Version of flutter_rust_bridge_codegen

1.49.1

Flutter info

[✓] Flutter (Channel unknown, 3.0.5, on Microsoft Windows [version
    10.0.22000.1098])
    • Flutter version 3.0.5 at E:\flutter
    • Upstream repository unknown
    • Framework revision f1875d570e (4 months ago), 2022-07-13
      11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK
    version 33.0.0)
    • Android SDK at E:\android_sdk\
    • Platform android-33, build-tools 33.0.0
    • ANDROID_SDK_ROOT = E:\Android\Sdk
    • Java binary at: E:\android\jre\bin\java
    • Java version OpenJDK Runtime Environment (build
      11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop for Windows (Visual Studio Community 2022
    17.3.6)
    • Visual Studio at D:\vs2022
    • Visual Studio Community 2022 version 17.3.32929.385
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2021.3)
    • Android Studio at E:\android
    • 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.13+0-b1751.21-8125866)

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft
      Windows [version 10.0.22000.1098]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome
      107.0.5304.88
    • Edge (web)        • edge    • web-javascript • Microsoft Edge
      106.0.1370.52

Version of clang++

No response

Version of ffigen

7.2.0

Additional context

pubspec.yaml:
name: flutter_rust_bridge_template
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.17.5 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  ffi: ^2.0.1
  flutter_rust_bridge: ^1.49.1
  freezed_annotation: ^2.2.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0
  ffigen: ^7.2.0
  build_runner: ^2.3.2
  freezed: ^2.2.1

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true
welcome[bot] commented 1 year ago

Hi! Thanks for opening your first issue here! :smile:

fzyzcjy commented 1 year ago

[SEVERE] : C:\Users\P\AppData\Local\Temp.tmpQkjiDZ.h:1:10: fatal error: 'stdbool.h' file not found [Lexical or Preprocessor Issue]

fzyzcjy commented 1 year ago

https://github.com/fzyzcjy/flutter_rust_bridge/issues/402

SULAPIS commented 1 year ago

402

Thanks! I finally generated the correct code and run it successfully! I run

flutter_rust_bridge_codegen --rust-input native/src/api.rs --dart-output lib/bridge_generated.dart --c-output ios/Runner/bridge_generated.h --c-output macos/Runner/bridge_generated.h --dart-decl-output lib/bridge_definitions.dart --wasm

in Developer Command Prompt for VS 2022 and it work, maybe I missed some environment variable settings. Feel free to close this issue, thanks for your support !

fzyzcjy commented 1 year ago

You are welcome!

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.