Sdk: [vm/ffi] Support iOS calling calling convention and library loading

Created on 11 Jun 2019  Â·  18Comments  Â·  Source: dart-lang/sdk

area-vm

Most helpful comment

The VM work is done. Once the decommissioning DBC work lands the FFI will work on iOS automatically. It also will already work in AOT (release/profile builds).

All 18 comments

Wanna follow up whether we can expect iOS support by Dec 2019?

Second this. Flutter makes sense for my project with FFI support for iOS but not without it. Can we get an ETA?

Sorry, usually we don't provide ETAs or concrete timelines. The work on FFI is going full steam and we hope to have all pieces necessary for Flutter developers to be able to develop apps using FFI on all supported platforms at some point in the near future.

The VM work is done. Once the decommissioning DBC work lands the FFI will work on iOS automatically. It also will already work in AOT (release/profile builds).

It also will already work in AOT (release/profile builds).

Wow, so AOT support for iOS comes even before AOT support for Android 🤓

AOT support for Android is already available actually :smile:

AOT support for Android is already available actually 😄

I'm so outdated 😆

Once the decommissioning DBC work lands the FFI

Can you point me to the issue tracking this one? Are these 2 the ones https://github.com/dart-lang/sdk/issues/35773 and https://github.com/dart-lang/sdk/issues/36809 ?

@sjindel-google can we use FFI with iOS already, or need to wait for some other github ticket? any example yet?

FFI is equally available for iOS and Android now.

I wouldn't call https://github.com/dart-lang/sdk/blob/master/samples/ffi/sqlite/docs/android.md an example, but you can find more information at https://github.com/flutter/flutter/wiki/Binding-to-native-code-via-FFI

@sjindel-google I can run iOS in debug mode, but when trying to run --profile or run --release on iOS, I got

 Running Xcode build...                                                  
 ├─Building Dart code...                                    30.8s
 ├─Assembling Flutter resources...                           1.8s
 └─Compiling, linking and signing...                         0.3s
Xcode build done.                                           34.5s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Profile ===
    Building AOT snapshot in profile mode (ios-profile)...          
    Building App.framework for arm64...
    ProcessException: Process exited abnormally:
    clang: error: unable to execute command: Segmentation fault: 11
    clang: error: linker command failed due to signal (use -v to see invocation)
      Command: xcrun clang -arch arm64 -miphoneos-version-min=8.0 -dynamiclib -Xlinker -rpath -Xlinker @executable_path/Frameworks
      -Xlinker -rpath -Xlinker @loader_path/Frameworks -install_name @rpath/App.framework/App -o build/aot/arm64/App.framework/App
      build/aot/arm64/snapshot_assembly.o
    cp: build/aot/App.framework: No such file or directory
    cp: /Users/truongsinh/Dev/ml/flutter_realtime_detection/ios/Flutter/App.framework/Info.plist: No such file or directory
    Project /Users/truongsinh/Dev/ml/flutter_realtime_detection built and packaged successfully.
    Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Profile ===
    ld: framework not found App
    clang: error: linker command failed with exit code 1 (use -v to see invocation).

```
[✓] Flutter (Channel master, v1.10.3-pre.37, on Mac OS X 10.14.6 18G95, locale en-VN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.38.1)
[✓] Connected device (3 available)

@truongsinh Are you using callbacks (fromFunction)?

no callback. To give you more context, I use only API from https://github.com/tensorflow/tensorflow/blob/r1.14/tensorflow/lite/experimental/c/c_api.h

It looks like we're generating Assembly snapshots which are crashing Clang.

@mraleph mentioned that he's seen this before and it may be caused by generating too many symbols.

@truongsinh Could you please share the .S file which clang is crashing on?

@truongsinh Could you please share the .S file which clang is crashing on?

Dumb question, how can I find this .S file 😅

Actually, I've opened a separate issue to investigate this: https://github.com/dart-lang/sdk/issues/38526

@truongsinh Please see my instructions in #38526

Was this page helpful?
0 / 5 - 0 ratings