Home | History | Annotate | only in /prebuilts/go/linux-x86/misc/ios
Up to higher level directory
NameDateSize
clangwrap.sh21-Aug-2018629
detect.go21-Aug-20183.5K
go_darwin_arm_exec.go21-Aug-201816.4K
README21-Aug-20181.9K

README

      1 Go on iOS
      2 =========
      3 
      4 To build a cross compiling toolchain for iOS on OS X, first modify clangwrap.sh
      5 in misc/ios to match your setup. And then run:
      6 
      7 	GOARM=7 CGO_ENABLED=1 GOARCH=arm CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
      8 	CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
      9 
     10 To build a program, use the normal go build command:
     11 
     12 	CGO_ENABLED=1 GOARCH=arm go build import/path
     13 
     14 To run a program on an iDevice, first make sure you have a valid developer
     15 certificate and have setup your iDevice properly to run apps signed by your
     16 developer certificate. Then install https://github.com/phonegap/ios-deploy.
     17 At a first step, you can try building the famous hello world program to run
     18 on your test device.
     19 (The needed files are provided at https://github.com/minux/go-ios-examples.)
     20 
     21 	# assume your program binary is helloworld.go, build it into the
     22 	# example hello.app bundle.
     23 	CGO_ENABLED=1 GOARCH=arm go build -o hello.app/hello helloworld.go
     24 	# sign the executable using your developer certificate
     25 	codesign -f -s "iPhone Developer" --entitlements hello.app/Entitlements.plist hello.app/hello
     26 	# run the program inside lldb on iDevice, run `ios-deploy` for more
     27 	# command options
     28 	ios-deploy --debug --uninstall --bundle hello.app
     29 	# Depending on your ios-deploy version, you might need to enter "run"
     30 	# into lldb to run your program, and its output will be shown by lldb.
     31 
     32 Notes:
     33  - A dummy hello.app bundle is provided in this directory to help you get started.
     34  - Running the program on an iDevice requires code sign and thus external linking,
     35    if your program uses cgo, then it will automatically use external linking.
     36    However, if your program does not use cgo, please make sure to add
     37 	import _ "runtime/cgo"
     38    so that external linking will be used.
     39 
     40 Known issues
     41 ============
     42  - crypto/x509 won't build, I don't yet know how to get system root on iOS.
     43  - Because I still want to be able to do native build, CGO_ENABLED=1 is not the
     44    default, yet.
     45