Monday, April 24, 2017

How to install iOS toolchain for Windows 64 bit

The instructions are here https://coolstar.org/theos.pdf
First, to install Cygwin (Run setup-x86_64.exe) for 64 bit versions of Windows with wget, git, ca-certificates, make, perl, openssh and python packages
Suggest to install zip and unzip packages as well.

The setup scripts for theos, toolchain and sdks are
shellscript    Select all
# the toollchain requires sdk files which are large, bette to put them in external drive cd /cygdrive/e git clone https://github.com/coolstar/theos.git && mkdir -p theos/toolchain/windows git clone -b x86_64 https://github.com/coolstar/iOSToolchain4Win.git theos/toolchain/windows/iphone # setup environment variable for THEOS export THEOS=/cygdrive/e/theos # update theos submodule cd $THEOS git submodule update --init --recursive mkdir -p $THEOS/sdks cd $THEOS/sdks # install the sdk by extracting the .tbz2 files # for example tar xjvf iPhoneOS8.1.sdk.tbz2 # create a Projects Folder outside theos folder cd ~ mkdir -p Projects cd Projects # create iPhone/tool project name "hello" $THEOS/bin/nic.pl cd hello make


Additional SDKs are here
iPhoneOS9.1.sdk.tbz2 (armv7, armv7s, arm64) https://mega.nz/#!PlxzHYjA!5c02sMSF6AE1M5CjuMt66tpFWHFx6sms_zeNyGMCukQ
iPhoneOS8.1.sdk.tbz2 (armv7, armv7s, arm64) https://mega.nz/#!us40SJaa!EpVL_VUgUji_H6QuTY_0YX7IG3ljTDrpzQgA1DMh2l8
iPhoneOS7.1.sdk.tbz2 (armv7, armv7s, arm64) https://mega.nz/#!qgYgmKgA!UR3dQ9ryusm251B8QcvUIo-DS_E2WXcDZENoa3q07RE
iPhoneOS6.1.sdk.tbz2 (armv7, armv7s) https://mega.nz/#!nkZDRA4D!8hJWkgYH2d3CxNtuWctCswBaAAdx4BLVuOLjGGVvKiA
iPhoneOS5.1.sdk.tbz2 (armv6, armv7) https://mega.nz/#!f4ADHaTI!FM57l5XrZMKscOoRrcwQqvtA4tzJxi7q6oDAa5QX1n0
iPhoneOS4.2.sdk.tbz2 (armv6, armv7) https://mega.nz/#!e5xA2K7b!ccK0N-y94bmSb6ifntcStAtssvD8qK9e3uAwAgrpmEU
iPhoneOS3.2.sdk.tbz2 (armv6, armv7) https://mega.nz/#!rkoylDSD!gxpXglAgcme5Wm2JurW3GCgSzUe4Y6ePMsW627xZ8hs


Edit ~/Projects/hello/Makefile to the following to allow FAT binary for different sdks
Projects/hello/Makefile    Select all
TARGET := iphone:clang # location of theos directory export THEOS=/cygdrive/e/theos # The base SDK location is what you build your app against (i.e. library files and frameworks) THEOS_PLATFORM_SDK_ROOT_armv6 = $(THEOS)/sdks/iPhoneOS5.1.sdk THEOS_PLATFORM_SDK_ROOT_armv7 = $(THEOS)/sdks/iPhoneOS7.1.sdk THEOS_PLATFORM_SDK_ROOT_armv7s = $(THEOS)/sdks/iPhoneOS7.1.sdk THEOS_PLATFORM_SDK_ROOT_arm64 = $(THEOS)/sdks/iPhoneOS8.1.sdk SDKVERSION_armv6 = 5.1 # 5.1 (armv6, armv7) SDKVERSION_armv7 = 7.1 # 7.1 (armv7, armv7s, arm64) SDKVERSION_armv7s = 7.1 # 7.1 (armv7, armv7s, arm64) SDKVERSION_arm64 = 8.1 # 8.1 (armv7, armv7s, arm64) # The SDK for include files, usually they should match with the library files and frameworks SDK INCLUDE_SDKVERSION_armv6 = 5.1 INCLUDE_SDKVERSION_armv7 = 7.1 INCLUDE_SDKVERSION_armv7s = 7.1 INCLUDE_SDKVERSION_arm64 = 8.1 # Deployment Target is the minimum required iOS version you application needs to run # usually base sdk version >= deployment target version TARGET_IPHONEOS_DEPLOYMENT_VERSION_armv6 = 5.0 TARGET_IPHONEOS_DEPLOYMENT_VERSION_armv7 = 6.0 TARGET_IPHONEOS_DEPLOYMENT_VERSION_armv7s = 7.0 TARGET_IPHONEOS_DEPLOYMENT_VERSION_arm64 = 8.0 # the default iphone architectures for this project build IPHONE_ARCHS = armv6 armv7 armv7s arm64 # ignore warnings export GO_EASY_ON_ME=1 include $(THEOS)/makefiles/common.mk TOOL_NAME = hello hello_FILES = main.mm include $(THEOS_MAKE_PATH)/tool.mk


make again and examine the FAT binary
shellscript    Select all
cd ~/Projects/hello make clean make DEBUG=1 # examine the compiled FAT binary architecture $THEOS/toolchain/windows/iphone/bin/arm64-apple-darwin14-otool.exe -h .theos/obj/debug/hello




To install winpty in cygwin x64, type these commands
shellscript    Select all
wget --no-check-certificate https://github.com/rprichard/winpty/releases/download/0.4.2/winpty-0.4.2-cygwin-2.6.1-x64.tar.gz mkdir -p /usr/local tar xzvf winpty-0.4.2-cygwin-2.6.1-x64.tar.gz -C /usr/local/ --strip 1