Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/net/internal/socket: doesn't support darwin/arm64 #22301

Closed
dummyedu opened this issue Oct 17, 2017 · 7 comments
Closed

x/net/internal/socket: doesn't support darwin/arm64 #22301

dummyedu opened this issue Oct 17, 2017 · 7 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dummyedu
Copy link

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"

kcp "github.com/xtaci/kcp-go"

)

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

@dummyedu
Copy link
Author

The root cause seem to be that the zsys_darwin_arm64.go (for iOS arm64) is missing from golang.org/x/net/internal/socket

@ianlancetaylor ianlancetaylor changed the title golang.org/x/net/internal/socket doesn't support darwin_arm64 x/net/internal/socket: doesn't support darwin_arm64 Oct 17, 2017
@gopherbot gopherbot added this to the Unreleased milestone Oct 17, 2017
@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 17, 2017
@ianlancetaylor
Copy link
Contributor

CC @mikioh

@mikioh mikioh changed the title x/net/internal/socket: doesn't support darwin_arm64 x/net/internal/socket: doesn't support darwin/arm64 Oct 25, 2017
@mikioh
Copy link
Contributor

mikioh commented Oct 25, 2017

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.

@bkono
Copy link

bkono commented Nov 19, 2017

While I'm not sure what the correct approach to addressing this is, I brute forced it fairly easily. golang/net@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. :)

@mikioh
Copy link
Contributor

mikioh commented Nov 21, 2017

@bkono,

I guess that the ABI on darwin/arm64 is 64-bit based, so copying 32-bit views might be wrong.

@gopherbot
Copy link

Change https://golang.org/cl/79855 mentions this issue: internal/socket: add support for darwin/arm64

@bkono
Copy link

bkono commented Nov 25, 2017

@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.

@golang golang locked and limited conversation to collaborators Dec 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants