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

iOS Simulator linking issue (Apple Silicon) #4

Open
tinyjin opened this issue Mar 14, 2024 · 1 comment
Open

iOS Simulator linking issue (Apple Silicon) #4

tinyjin opened this issue Mar 14, 2024 · 1 comment
Labels
bug Something isn't working ios Flutter/iOS issues

Comments

@tinyjin
Copy link
Owner

tinyjin commented Mar 14, 2024

Installation bug from building with iOS Simulator hosted by M1 (SoC)
Probably, dylib for ios-sim on arm64 is missing.

Launching lib/main.dart on iPhone 15 Pro in debug mode...
Running pod install...                                           1,252ms
Running Xcode build...
 └─Compiling, linking and signing...                        10.4s
Xcode build done.                                           35.3s
Failed to build iOS app
Error (Xcode): Building for 'iOS-simulator', but linking in dylib
(../ios/Frameworks/libthorvg.dylib) built for 'iOS'


Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)


Could not build the application for the simulator.
Error launching application on iPhone 15 Pro.
@tinyjin tinyjin added the bug Something isn't working label Mar 14, 2024
@tinyjin
Copy link
Owner Author

tinyjin commented Mar 17, 2024

Previously, iOS binary is built with lipo (Fat Binary). In the Fat Binary, simulator binary for Apple Silicon cannot be merged in single binary due to the same architecture with iPhone OS.

The ideal approach is to build a xcframework, which is more optimal and suitable as a universal binary.

Frameworks/libthorvg.xcframework

# lottie_thorvg.podspec
s.vendored_frameworks = 'Frameworks/libthorvg.xcframework'

We can build them via script:

# Universal sim binary
lipo path/to/ios-simulator/aarch64/libthorvg.dylib \
path/to/ios-simulator/x86_64/libthorvg.dylib \
-output libthorvg.dylib -create

# Build xcframework
xcodebuild -create-xcframework \
-library path/to/ios/libthorvg.dylib \
-library path/to/ios-simulator/libthorvg.dylib \
-output libthorvg.xcframework

@tinyjin tinyjin changed the title Simulator linking issue iOS Simulator linking issue (Apple Silicon) Mar 17, 2024
@tinyjin tinyjin added the ios Flutter/iOS issues label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios Flutter/iOS issues
Projects
None yet
Development

No branches or pull requests

1 participant