Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spine-flutter] not compatible with use_frameworks! :linkage => :static #2438

Closed
hyiso opened this issue Dec 25, 2023 · 5 comments
Closed

[spine-flutter] not compatible with use_frameworks! :linkage => :static #2438

hyiso opened this issue Dec 25, 2023 · 5 comments
Assignees
Labels

Comments

@hyiso
Copy link

hyiso commented Dec 25, 2023

Adding spine_flutter to a Flutter module (for add2app usage), and run the host iOS project, it can't find the spine_flutter.framework/spine_flutter when opening Flutter page in Debug mode

flutter: Invalid argument(s): Failed to load dynamic library 'spine_flutter.framework/spine_flutter': dlopen(spine_flutter.framework/spine_flutter, 1): image not found
flutter: #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
flutter: #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
flutter: #2      _dylib.<anonymous closure> (package:spine_flutter/init.dart:38:27)
flutter: #3      _dylib (package:spine_flutter/init.dart:47:2)
flutter: #4      _dylib (package:spine_flutter/init.dart)

Flutter SDK version is 3.7.12
spine_flutter version is 4.2.12

@badlogic
Copy link
Collaborator

I'm afraid I have no experience with add2app. Do you happen to know if it has special requirements regarding loading dynamic libraries?

@badlogic badlogic self-assigned this Dec 27, 2023
@badlogic badlogic added the bug label Dec 27, 2023
@hyiso
Copy link
Author

hyiso commented Dec 28, 2023

I'm not sure whether this plugin needs any configurations else, as I cannot find spine_flutter.framework in the Frameworks directory under the output HostProject.app

@hyiso
Copy link
Author

hyiso commented Dec 28, 2023

I've tested a simple add2app example, only a little different from my iOS host project, this plugin runs as expected.

The main difference is in Podfile

# Simple add2app example
use_frameworks!
# My iOS host project
use_frameworks! :linkage => :static

It seems not compatible with :linkage => :static

Then I changed the Podfile of the simple add2app example with :linkage => :static, it throws the exception.

So the real problem is that this plugin cannot be used with :linkage => :static

In my iOS host project, some other static libraries are required, so :linkage => :static cannot be removed.

Could this plugin support using static library?

@hyiso
Copy link
Author

hyiso commented Dec 28, 2023

Also tried the example in spine-flutter, adding :linkage => :static, after use_frameworks!, it also throws the exception

@hyiso hyiso changed the title [spine-flutter] Failed to load dynamic library 'spine_flutter.framework/spine_flutter' in add2app usage [spine-flutter] not compatible with use_frameworks! :linkage => :static Dec 28, 2023
@badlogic
Copy link
Collaborator

badlogic commented Apr 30, 2024

Sorry for this taking so long. I believe I have fixed this. You will have to adjust the way spine-flutter is initialized. E.g.

  await initSpineFlutter(useStaticLinkage: true);

This will instruct Dart FFI to lookup symbols in the process/executable instead of trying to locate them in a framework.

I've published a new spine_flutter package to pub.dev, version 4.2.24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants