-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Question] How should I build for iOS Simulator? I need to be able to compile simulators (even if I don't run the model in them) #2929
Comments
Unfortunately the SDK relies on GPU so do not work on simulator for now. One way to run might be to build for iPad on Mac. |
So having this an app completely disables the ability to run the app on simulator? |
the easiest way is the @tqchen solution, but always test on physical device, because these kind of bugs can happen: |
I think ideally all this should be housed in a framework that is marked unavailable on simulator |
I am not that familar with iOS part of such dev, but the original swift source is here https://github.com/mlc-ai/mlc-llm/tree/main/ios/MLCSwift, feel free to take a look and see if any change can be made |
It seems like it would be ideal for there to be a script that generates an XCFramework with all that is necessary. I tried to make some progress on that last night but am running into so many linker issues. Is there someone who was responsible for generating the Swift package that is familiar with static library linking? |
@PabloButron i have just spend the better part of two evenings trying and failing to compile this on simulator. I need to be able to develop using SwiftUI previews on simulators. I do not need to run the actual model on a sim. I've tried xcframeworks but hit dead ends. I've tried to mimic the steps for integrating MLC into a code project for both frameworks and static libraries. I'm having a very hard time of it. So if you have any ideas, even if not easy, I could use them |
Of course, I can conditionalize all of the other Swift linker flags… But how to conditionally link this Library? It's been a huge pain that this doesn't work out of the box for XC framework archives. You can't set the build for release flag to true |
I followed the SDK guide for implementing this into an iOS app. That works. I have it compiling on device. However, if I try to use SwiftUI previews or try to build to simulator I get
ld: warning: no platform load command found in '/Users/user/Developer/JournalApp/dist/lib/libmodel_iphone.a2', assuming: iOS-simulator
ld: warning: no platform load command found in '/Users/user/Developer/JournalApp/dist/lib/libmodel_iphone.a3', assuming: iOS-simulator
ld: warning: no platform load command found in '/Users/user/Developer/JournalApp/dist/lib/libmodel_iphone.a4', assuming: iOS-simulator
ld: warning: no platform load command found in '/Users/user/Developer/JournalApp/dist/lib/libmodel_iphone.a5', assuming: iOS-simulator
ld: warning: no platform load command found in '/Users/user/Developer/JournalApp/dist/lib/libmodel_iphone.a6', assuming: iOS-simulator
ld: warning: no platform load command found in '/Users/user/Developer/JournalApp/dist/lib/libmodel_iphone.a7', assuming: iOS-simulator
ld: warning: no platform load command found in '/Users/user/Developer/JournalApp/dist/lib/libmodel_iphone.a8', assuming: iOS-simulator
ld: warning: no platform load command found in '/Users/user/Developer/JournalApp/dist/lib/libmodel_iphone.a9', assuming: iOS-simulator
ld: building for 'iOS-simulator', but linking in object file (/Users/user/Developer/JournalApp/dist/lib/libmlc_llm.a2) built for 'iOS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The text was updated successfully, but these errors were encountered: