Skip to content

Instantly share code, notes, and snippets.

@okanon
Last active April 20, 2018 15:29
Show Gist options
  • Save okanon/3ea851017072f293fbd52d38c6b96a7e to your computer and use it in GitHub Desktop.
Save okanon/3ea851017072f293fbd52d38c6b96a7e to your computer and use it in GitHub Desktop.
Install iOSToolChain & iphoneos arm64 Clang on Ubuntu

Install iOSToolChain & arm64 Clang on Ubuntu16.04-17.10

PREREQUISITES:

See cctools/ld64 README + libssl-dev, git, bash, cmake and a jailbroken iOS device

USAGE:

Please ensure you have read and understood the Xcode license terms before building this toolchain: https://www.apple.com/legal/sla/docs/xcode.pdf.

[LLVM_DSYMUTIL=llvm-dsymutil] ./build.sh /path/to/sdk.tar.*

Target CPU should be one of armv6, armv7, armv7s and arm64.

This will build an iOS toolchain prefixed with arm-apple-darwin11-*

You can then use arm-apple-darwin11-clang / arm apple-darwin11-clang++ to build your applications.


IPHONEOS_DEPLOYMENT_TARGET can be used to target older iOS versions.

For example:

export IPHONEOS_DEPLOYMENT_TARGET=5.0

will target iOS 5.0.


ISSUES:

ISSUE: clang: error: invalid version number in '-miphoneos-version-min=10.2' SOLUTION: Targeting iOS >= 10.0 requires Clang >= 4.0.


PACKAGING THE SDK:

Ensure you have read and understood the Xcode license terms before continuing. => https://www.apple.com/legal/sla/docs/xcode.pdf

Packaging recents SDKs requires Mac OS Sierra.

Download Xcode 8.2.1 and extract its content. Then issue the following commands:

SDK=$(ls -l Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs | grep " -> iPhoneOS.sdk" | head -n1 | awk '{print $9}') cp -r Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk /tmp/$SDK 1>/dev/null cp -r Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /tmp/$SDK/usr/include/c++ 1>/dev/null pushd /tmp tar -cvzf $SDK.tar.gz $SDK rm -rf $SDK mv $SDK.tar.gz ~ popd

The SDK should be now in your home directory.

Installation

git clone github.com/okanon/cctools-port
cd cctools-port 
git submodule --update -i

cd usage_examples/ios_toolchain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment