-
Notifications
You must be signed in to change notification settings - Fork 58
feat(tutorials): add a tutorial on using ios sdk and llvm to package ios applications on windows #179
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
Merged
Merged
feat(tutorials): add a tutorial on using ios sdk and llvm to package ios applications on windows #179
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| --- | ||
| title: Packaging on Windows | ||
| --- | ||
|
|
||
| Packaging iOS applications on Windows is not supported by Apple, however, the AIR SDK has been able to get around this for a long time by creating stubs of the iOS SDK and using a specially packaged version of the open source Apple linker. | ||
|
|
||
| More recently, however, this has become more difficult as Apple have made changes to their toolchain and the AIR SDK can no longer successfully package all iOS applications on Windows. This becomes more apparent when trying to package applications that use more recent iOS SDK features, frameworks or capabilities, and particularly when swift code is involved. | ||
|
|
||
| You may run into issues like: | ||
|
|
||
| - Errors about missing symbols when packaging / linking (particularly related to swift) | ||
| - Errors about framework signatures | ||
| - Installation verification errors when installing on device | ||
|
|
||
| The simplest solution to these issues is to package your iOS applications on a Mac. However if you need to package on Windows then please see the following suggestions that may help you resolve some of these issues. | ||
|
|
||
|
|
||
| ## Providing an iOS SDK | ||
|
|
||
| The AIR SDK includes stubs of the iOS SDK to allow it to compile and link iOS applications. This may or may not include all the symbols and frameworks that your application needs. | ||
|
|
||
| However you can use a full version of the iOS SDK from a Mac to provide the missing symbols and frameworks. | ||
|
|
||
|
|
||
| ### Obtaining the iOS SDK | ||
|
|
||
| You can copy the iOS SDK from a Mac that has Xcode installed. The SDKs are located in the following folder: | ||
|
|
||
| ``` | ||
| /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs | ||
| ``` | ||
|
|
||
| You will see one or more folders named like `iPhoneOSXX.X.sdk` where `XX.X` is the version number of the SDK (e.g. `iPhoneOS18.4.sdk`). | ||
|
|
||
| :::note | ||
| Avoid using the generic `iPhoneOS.sdk` name as this is a symbolic link to the latest version | ||
| ::: | ||
|
|
||
| You need to copy the entire `iPhoneOSXX.X.sdk` folder to your Windows machine. Due to the symbolic links in the SDK it is best to use a tool that can handle these correctly, such as `rsync` or `zip`. For example, you can use `zip` on the command line as below: | ||
|
|
||
| ``` | ||
| zip -r iPhoneOS18.4.sdk.zip /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk | ||
| ``` | ||
|
|
||
| :::note | ||
| Make sure you use the actual version number of the SDK you are copying. | ||
| ::: | ||
|
|
||
| Copy this zip file to your Windows machine and extract it to a folder where you want to keep the iOS SDK (e.g. `C:\Users\yourname\work\sdks\ios\iPhoneOS18.4.sdk`). | ||
|
|
||
|
|
||
|
|
||
| ### Configuring the AIR SDK | ||
|
|
||
| #### AIR SDK Manager | ||
|
|
||
| The easiest way to configure the AIR SDK to use the iOS SDK is to use the AIR SDK Manager application. | ||
|
|
||
| 1. Open the AIR SDK Manager application | ||
| 2. Select the "Configuration" tab | ||
|
|
||
|  | ||
|
|
||
| 3. In the "iOS" section, find the "iOS Platform SDK" and either enter or browse for the path to the `iPhoneOSXX.X.sdk` folder that you extracted | ||
|
|
||
|  | ||
|
|
||
| 4. Click "Apply" to save the configuration | ||
|
|
||
| Any iOS applications that you package using the AIR SDK will now use the provided iOS SDK. | ||
|
|
||
|
|
||
| #### Configuration File | ||
|
|
||
| You can also configure the iOS SDK by editing the `adt.cfg` file located in the `~/.airsdk` folder of your user directory. | ||
|
|
||
| :::note | ||
| This file is where the AIR SDK Manager saves its configuration, so if you have already configured the iOS SDK using the AIR SDK Manager then you should see the path already set in this file. | ||
| ::: | ||
|
|
||
| Add or edit the following line to point to the path of the `iPhoneOSXX.X.sdk` folder that you copied from the Mac: | ||
|
|
||
|
|
||
| ``` | ||
| ... | ||
|
|
||
| iOSPlatformSDK=C:/Users/yourname/work/sdks/ios/iPhoneOS18.4.sdk | ||
|
|
||
| ... | ||
| ``` | ||
|
|
||
| This will configure the AIR SDK to use the provided iOS SDK for all iOS applications that you package. | ||
|
|
||
|
|
||
| #### Command line | ||
|
|
||
| You can also configure a specific build command to use the iOS SDK by adding the `-platformsdk` option to your `adt` command. | ||
|
|
||
| ``` | ||
| adt -package -target | ||
| ... | ||
| -platformsdk "C:/Users/yourname/work/sdks/ios/iPhoneOS18.4.sdk" | ||
| ... | ||
| ``` | ||
|
|
||
| This will configure the AIR SDK to use the provided iOS SDK for this specific packaging command only. | ||
|
|
||
|
|
||
| ## Installing the LLVM toolchain | ||
|
|
||
| :::info | ||
| A lot of issues are solved by simply providing a full iOS SDK, however some issues may still remain due to limitations in the version of the Apple linker included in the AIR SDK. | ||
| If after providing the iOS SDK you still have issues linking (for example, missing symbols when building) then you can try installing a more recent version of the LLVM toolchain for Windows. | ||
|
|
||
| This is not guaranteed to solve all issues, but it may help in some cases. | ||
| ::: | ||
|
|
||
| The AIR SDK uses a custom version of the Apple linker to create iOS applications on Windows. | ||
| This is included in the AIR SDK but it is based on an older version of the Apple toolchain and may not work with all applications. | ||
|
|
||
|
|
||
| ### Installation | ||
|
|
||
| You can try installing a more recent version of the LLVM toolchain for Windows from here: | ||
|
|
||
| https://github.com/llvm/llvm-project | ||
|
|
||
| Download the installer executable appropriate for your system (e.g. `LLVM-15.0.7-win64.exe`) and run it to install the toolchain. | ||
|
|
||
| If you leave the default options selected it will install to `C:\Program Files\LLVM` and the AIR SDK will automatically find it. | ||
|
|
||
| However if you install it to a different location you will need to set the `LLVM_HOME` configuration in your `adt.cfg` file to point to the folder of the LLVM installation. | ||
| For example: | ||
|
|
||
| ``` | ||
| AndroidPlatformSDK=C:/Users/yourname/work/sdks/android | ||
| iOSPlatformSDK=C:/Users/yourname/work/sdks/ios/iPhoneOS18.4.sdk | ||
| LLVM_HOME=C:/Program Files/LLVM | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| You can confirm that the AIR SDK is using the LLVM toolchain by looking at the `adt.log` output when packaging an iOS application. | ||
| You should see something like this: | ||
|
|
||
| ``` | ||
| ld64 command line: C:/Program Files/LLVM/bin/ld64.lld.exe -pie -ObjC ... | ||
| ``` | ||
|
|
||
| whereas if it is using the built-in linker you will see something like this (using `ld64.exe` from within the AIR SDK): | ||
|
|
||
| ``` | ||
| ld64 command line: C:\AIRSDK_51.2.2\lib\aot/bin/ld64/ld64.exe -pie -ObjC ... | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command example is incomplete and may confuse users. Consider providing a more complete example or clearly indicating this is a partial command snippet.