Closed dummyedu closed 6 years ago
The root cause seem to be that the zsys_darwin_arm64.go (for iOS arm64) is missing from golang.org/x/net/internal/socket
CC @mikioh
Thanks for the report. Unfortunately I'm not an iOS user and have no iOS stuff. Feel free to send a changelist that probably contains a only platform-dependent boilerplate file. I guess that Mr. Taylor will review the CL.
If you have some test failure for x/net packages on darwin/arm64, please open a new issue.
While I'm not sure what the correct approach to addressing this is, I brute forced it fairly easily. https://github.com/golang/net/compare/master...bkono:bk_adding_darwin_arm64 ... All that I needed was a simple copy of the existing zsys_darwin_arm.go to zsys_darwin_arm64.go and swapping the iovec Len from uint32 to uint64. With that minor change, my ios framework built successfully under gomobile. Given my test case is an iOS framework as sdk that embeds go-micro and gRPC with standard rpc and server -> client streaming methods, which all worked successfully in my Xamarin.Forms and fusetools test apps, it's at least passing a basic sanity check for me.
+type iovec struct {
+ Base *byte
+ Len uint64
+}
Hope that helps others coming to the thread. If you'd like to point me in the right direction, I'd be happy to take a look at a proper fix rather than the blunt version. :)
@bkono,
I guess that the ABI on darwin/arm64 is 64-bit based, so copying 32-bit views might be wrong.
Change https://golang.org/cl/79855 mentions this issue: internal/socket: add support for darwin/arm64
@mikioh Agreed. I started down the 64bit path and hit some odd issues. Likely my fault, but when I backed up and made the change indicated above, bafflingly, I didn't run into any problems and it actually worked when lightly exercised. I'm not expecting it to hold up under proper testing though.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/lining/go" GORACE="" GOROOT="/usr/local/Cellar/go/1.9/libexec" GOTOOLDIR="/usr/local/Cellar/go/1.9/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/go-build981751935=/tmp/go-build -gno-record-gcc-switches -fno-common" CXX="clang++" CGO_ENABLED="1" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config"
What did you do?
If possible, provide a recipe for reproducing the error.
Write a custom file and run file: // +build linux darwin freebsd
package kcpgousage
import ( "log"
)
func Test() { log.Printf("KCP SNMP:%+v", kcp.DefaultSnmp.Copy()) } command: gomobile bind -target ios -o kcpgousage.framework -v kcpgousage
Sorry for importing custom package because I am new to go and can't write a file to use golang.org/x/net/internal/socket with easy.
A complete runnable program is good. A link on play.golang.org is best.
What did you expect to see?
The command can be run successfully and the framework is generated.
What did you see instead?
../../../../go/src/golang.org/x/net/internal/socket/cmsghdr.go:9:10: undefined: cmsghdr