LtbLightning / bdk-flutter

Bitcoin Development Kit - Flutter Package
MIT License
60 stars 27 forks source link

iOS, Rust exception in app with flavors #50

Closed awaik closed 1 year ago

awaik commented 1 year ago

Hi!

When I try to run the code under iOS I got an error

code

final mnemonic =
        await Mnemonic.fromString('puppy interest whip tonight dad never sudden response push zone pig patch');

error

[VERBOSE-2:dart_vm_initializer.cc(41)] 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      RustWire._store_dart_post_cobjectPtr (package:bdk_flutter/src/generated/bindings.dart:1714:76)
#2      RustWire._store_dart_post_cobjectPtr (package:bdk_flutter/src/generated/bindings.dart)
#3      RustWire._store_dart_post_cobject (package:bdk_flutter/src/generated/bindings.dart:1716:41)
#4      RustWire._store_dart_post_cobject (package:bdk_flutter/src/generated/bindings.dart)
#5      RustWire.store_dart_post_cobject (package:bdk_flutter/src/generated/bindings.dart:1708:12)
#6      StoreDartPostCObjectExt.storeDartPostCObject (package:flutter_rust_bridge/src/ffi/io.dart:18:5)
#7      FlutterRustBridgeBase._setUpRustToDartComm (package:flutter_rust_bridge/src/basic.dart:60:11)
#8      new FlutterRustBridgeBase (packag<…>

Plugin version - bdk_flutter: ^0.3.1 Doctor

[✓] Flutter (Channel stable, 3.3.10, on macOS 13.0.1 22A400 darwin-arm, locale en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
[✓] VS Code (version 1.74.0)
[✓] Connected device (5 available)
    ! Error: Aleksei’s Apple Watch needs to connect to determine its availability. Check the
      connection between the device and its companion iPhone, and the connection between the
      iPhone and Xcode. Both devices may also need to be restarted and unlocked. (code 1)
[✓] HTTP Host Availability

• No issues found!
BitcoinZavior commented 1 year ago

Just tried this, not able to reproduce. Let me know if you are using a simulator or device, and environment details.

You can also try flutter clean and then flutter pub get and run again

Have you been able to run the example app?

awaik commented 1 year ago

Hi! Thanks, complete clean + pod update fixed the issue, thank you!

awaik commented 1 year ago

Nope, same error again. Should I do some additional installation for the iOS?

  1. I've checked - the example app works.
  2. If I copy-paste the code to my app it returns this error.
awaik commented 1 year ago

I found the reason, how to reproduce the bug:

  1. example app
  2. create a scheme (flavor) under ios, two gifs, takes 3 mins:
  3. run this flavor flutter run --flavor dev

We got the error

[VERBOSE-2:dart_vm_initializer.cc(41)] 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:33:70)
#1      RustWire._store_dart_post_cobjectPtr (package:bdk_flutter/src/generated/bindings.dart:1714:76)
#2      RustWire._store_dart_post_cobjectPtr (package:bdk_flutter/src/generated/bindings.dart)
#3      RustWire._store_dart_post_cobject (package:bdk_flutter/src/generated/bindings.dart:1716:41)
#4      RustWire._store_dart_post_cobject (package:bdk_flutter/src/generated/bindings.dart)
#5      RustWire.store_dart_post_cobject (package:bdk_flutter/src/generated/bindings.dart:1708:12)
#6      StoreDartPostCObjectExt.storeDartPostCObject (package:flutter_rust_bridge/src/ffi/io.dart:18:5)
#7      FlutterRustBridgeBase._setUpRustToDartComm (package:flutter_rust_bridge/src/basic.dart:60:11)
#8      new FlutterRustBridgeBase (package:flutter_rust_bridge/src/basic.dart:28:5)
#9      new RustPlatform (package:bdk_flutter/src/generated/bindings.dart:1248:44)
#10     new RustImpl (package:bdk_flutter/src/generated/bindings.dart:19:59)
#11     loaderApi (package:bdk_flutter/src/utils/loader.dart:9:19)
#12     loaderApi (package:bdk_flutter/src/utils/loader.dart)
#13     Mnemonic.fromString (package:bdk_flutter/src/root.dart:783:25)
#14     _MyAppState.createDescriptorSecret (package:first_app/main.dart:46:24)
#15     _MyAppState.restoreWallet (package:first_app/main.dart:36:11)
#16     _MyAppState.initState (package:first_app/main.dart:24:5)
#17     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5101:55)
#18     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#19     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#20     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#21     RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1176:16)
#22     RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1145:5)
#23     RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1092:18)
#24     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2682:19)
#25     RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1091:13)
#26     WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:926:7)
#27     WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:906:7)
#28     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#29     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#30     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#31     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
BitcoinZavior commented 1 year ago

@awaik Was this resolved?

awaik commented 1 year ago

@BitcoinZavior Nope, for avoiding confusion because of the wrong first message, before I found the exact reason, I made a new issue https://github.com/LtbLightning/bdk-flutter/issues/52