dart-archive/wasm

iOS support has some problems

Closed this issue · 1 comments

i pull ios_support branch, and run flutter pub run flutter_wasm:ios_setup(but readme.md says flutter pub run flutter_wasm:setup,should update?), then get this exception:

Unhandled exception:
RangeError (index): Invalid value: Valid value range is empty: 0
#0      List.[] (dart:core-patch/growable_array.dart:264:36)
#1      main (file:///Users/yuvan/Documents/github/wasm/flutter_wasm/bin/ios_setup.dart:98:32)
<asynchronous suspension>
pub finished with exit code 255

I read this file ios_setup.dart,Found several paths in the file that are absolute,for example:

final frameworkTemplatePath = '/Users/liama/dev/wasm/flutter_wasm/ios/FrameworkTemplate

Then I changed it to my local path,Run flutter pub run flutter_wasm:ios_setup again with a successful result:

Creating fat library for iphoneos at /Users/yuvan/Documents/github/wasm/flutter_wasm/example/.dart_tool/pub/bin/flutter_wasm/ios/build/iphoneos/flutter_wasm
FFFFF: /Users/yuvan/Documents/github/wasm/flutter_wasm/example/.dart_tool/pub/bin/flutter_wasm/ios_setup.dart-2.18.2.snapshot
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo -create /Users/yuvan/Documents/github/wasm/flutter_wasm/example/.dart_tool/pub/bin/flutter_wasm/ios/build/iphoneos/aarch64-apple-ios/libwasmer.dylib -output /Users/yuvan/Documents/github/wasm/flutter_wasm/example/.dart_tool/pub/bin/flutter_wasm/ios/build/iphoneos/flutter_wasm
Creating framework at /Users/yuvan/Documents/github/wasm/flutter_wasm/example/Frameworks/flutter_wasm.xcframework
FFFFF: /Users/yuvan/Documents/github/wasm/flutter_wasm/example/.dart_tool/pub/bin/flutter_wasm/ios_setup.dart-2.18.2.snapshot
xcrun xcodebuild -create-xcframework -framework /Users/yuvan/Documents/github/wasm/flutter_wasm/example/.dart_tool/pub/bin/flutter_wasm/ios/build/iphoneos/lib_wasm.framework -output /Users/yuvan/Documents/github/wasm/flutter_wasm/example/Frameworks/flutter_wasm.xcframework
xcframework successfully written out to: /Users/yuvan/Documents/github/wasm/flutter_wasm/example/Frameworks/flutter_wasm.xcframework

But when I run it next example/lib/main.dart,get this error

Error (Xcode): File not found: /Users/yuvan/Documents/github/wasm/flutter_wasm/example/ios/Pods/../.symlinks/plugins/flutter_wasm/ios/Frameworks/flutter_wasm.xcframework/ios-x86_64-simulator/flutter_wasm

I mean, are you sure the ios example is runnable? or rather ios is supported?

iOS is not supported yet. That branch is for this WIP pull request.

That PR is blocked on some build system issues. If you manually fiddle with the paths and copy files around, you might be able to get it to build, but the library isn't linked into the app and the symbols aren't found at runtime. I'm not actively working on fixing this at the moment, but there's a big improvement coming to the way FFI libraries are built that should solve the problem.