firstfloorsoftware / flutter_sodium

Flutter bindings for libsodium
BSD 3-Clause "New" or "Revised" License
102 stars 47 forks source link

Error executing included example app on iOS #38

Closed soyangel closed 3 years ago

soyangel commented 4 years ago

Hi,

Included example app crashes on iOS:

Jun 16 13:48:42 iPhone-7 Runner(Flutter)[510] : [VERBOSE-2:ui_dart_state.cc(166)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol (dlsym(RTLD_DEFAULT, sodium_init): symbol not found)

0 DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:31)

1 new SodiumBindings (package:flutter_sodium/src/bindings/sodium_bindings.dart:9)

2 Sodium._sodium (package:flutter_sodium/src/sodium.dart:49)

3 Sodium._sodium (package:flutter_sodium/src/sodium.dart:0)

4 Sodium.sodiumInit (package:flutter_sodium/src/sodium.dart:2013)

5 main (package:flutter_sodium_example/main.dart:7)

6 _runMainZoned.. (dart:ui/hooks.dart:247)

7 _rootRun (dart:async/zone.dart:1190)

8 _CustomZone.run (dart:async/zone.dart:1093)

9 _runZoned (dart:async/zone.dart:1630)

10 runZonedGuarded (dart:async/zone.dart:1618)

11 _runMainZoned. (dart:ui/hooks.dart:239)

12 _startIsolate. (dart:isolate-patch/isolate_patch.dart:\M-b\M^@\M-&

Flutter 1.19.0-4.1.pre • channel beta • https://github.com/flutter/flutter.gitFramework • revision f994b76974 (7 days ago) • 2020-06-09 15:53:13 -0700Engine • revision 9a28c3bcf4Tools • Dart 2.9.0 (build 2.9.0-14.1.beta)

kozw commented 4 years ago

Unable to reproduce on iPhoneX with flutter beta. Assuming you're trying to debug example app as-is to device?

soyangel commented 4 years ago

I'm just compiling from example dir with:

flutter build its

and then Archive - Product - export as Ad hoc from Xcode. Same as with my other Flutter apps that work (e.g. the real app I'm using this library on that it's working ok with a version previous to FFI).

Maybe I have to set some option on Xcode so it links the .a?

Running on iPhone 7 with iOS: 13.4.1 Xcode: 11.4.1

kozw commented 4 years ago

Yes, so debug mode seems to work just fine. Release mode not so much, I'm running into a white screen without any error logging whatsoever. Investigating.

kozw commented 4 years ago

Possibly related: https://github.com/dart-lang/native/issues/897

kozw commented 3 years ago

I've just pushed an update that might fix the function lookup failure in release mode. Does this work for you?

soyangel commented 3 years ago

It works great here.

Thanks for your work!