- edited description
Cannot build for arm64
Hello again :)
As of this Sunday, Apple is now requiring all apps deployed to the App Store contain a slice for arm64. I'm trying to build the Go-iOS toolchain for arm64 but not having any success. Steps to reproduce:
-
Check out
goios
-
Modify clangwrap.sh to pass
arm64
to clang:exec "$CLANG" -arch arm64 -isysroot "$SDK_PATH" "$@"
-
Build Go toolchain
GOARM=7 CGO_ENABLED=1 GOARCH=arm CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
-
Make a hello world app and run
go build
-
Run
lipo -info
tool on generated binary: showsNon-fat file: tmp is architecture: armv7
Comments (15)
-
reporter -
reporter I found a relevant patch:
Teach cmd/dist about GOARCH=arm64
However after applying that patch, the build fails:
##### Building compilers and Go bootstrap tool for host, darwin/amd64. lib9 libbio liblink cmd/gc cmd/6l cmd/7l go tool dist: opendir /Users/.../goios-arm64/src/cmd/7l: No such file or directory
-
repo owner Go doesn't support arm64 yet. The Linux port is in the works (it is in final stages now). I will start darwin/arm64 port as soon as that project finishes.
-
reporter Ahh I see. Is that an easy port since you've already done the arm port? Or is arm64 very different?
-
repo owner It will not be as easy as the arm port because the linux/arm64 port doesn't support cgo yet. (And cgo is not in their goals.)
I first need to get cgo working for linux/arm64 (and yes, I also wrote cgo for linux/arm), but that needs more time.
The actual port to darwin/arm64 shouldn't be too difficult if linux/arm64 is ready.
You can monitor the progress of the linux/arm64 port here: https://github.com/4ad/go
-
reporter Sent you an email. Let me know how I can help :)
-
repo owner The ios64 branch is the work in progress for this issue.
Basic binaries are running fine now.
-
repo owner OK, the ios64 branch is fully functional.
-
Greetings minux, and thanks for the great work on goios. I plan on using Go code on iOS, and so to that end I set up a ready-made XCode harness, set up to build a moderately large Go package (ipfs) as a test-bed. At the moment I do not have it configured for arm64 - so ios64 is in a productive/usable status? I will report back...
EDIT: ipfsios here: https://github.com/seclorum/ipfs-on-ios.git
-
repo owner The port has already upstreamed, so you can use the tip version of the official Go for both 32 and 64 bit iOS development.
Or you can wait for Go 1.5, to be released in 3 months. There will be official gomobile build tool for iOS and android.
-
Thanks for the info - will take it into account. I've been able to build ipfs in the meantime ..
-
This is great. I was able to build an armv7/arm64 universal library by working off Keith's posts. :)
Only hitting one snag in getting my app to validate with iTunes. Apparently the call to exc_server here is a problem: https://github.com/golang/go/blob/989f0ee80a57c7c57fe4ae238d14cbffe8f9fd87/src/runtime/cgo/gcc_signal_darwin_armx.c#L173
Error: iTunes Store operation failed. Your app contains non-public API usage. This app references non-public symbols ... exc_server.
Can we work around that?
-
repo owner You need to rebuild Go with -tags lldb (GOARCH=arm64 GOOS=darwin CGO_ENABLED=1 go install -a -v std), I will report this problem upstream.
-
repo owner FYI, this is fixed at tip in the upstream. The bug is tracked at https://golang.org/issue/10646.
And the meaning for lldb build tag is reversed, so if you use the latest Go tip (or Go 1.5), then you don't need the lldb build tag.
-
repo owner - changed status to resolved
arm64 port upstreamed and is passing tests.
- Log in to comment