I add a simple test case. // +build linux darwin freebsd
package kcpgousage import ( "log" kcp "github.com/xtaci/kcp-go" ) func Test() { log.Printf("KCP SNMP:%+v", kcp.DefaultSnmp.Copy()) } go bind this file will have similor errors. 在 2017年10月16日星期一 UTC+8上午11:45:18,dumm...@gmail.com写道: > > I want to use a go library( https://github.com/xtaci/kcp-go ) and compile > it on ios platform. The library itself can't be totally exported because > go-mobile type limitation. > > I write a custom package to use the library and export function to be used > in ios platform. But gomobile bind give errors. The full log is attached > later. > > The error line is ../../../go/src/ > golang.org/x/net/internal/socket/cmsghdr.go:9:10: undefined: cmsghdr > > gomobile bind works if I don't import the kcp-go library. And from the > output, It seems that internal/socket can't link to the right ios library. > > I try to google the solution but nothing useful found. Anyone can help me > for the issue? Is this gomobile limitation? How can I fix this problem. > Thanks. > > > Command: > > gomobile bind -target ios -o kcpgousage.framework -v kcpgousage > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/interfaces.go > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/gen/src/ObjC/interfaces.go > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/interfaces.h > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/interfaces.m > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/fakegopath/pkg/darwin_arm/kcpgousage.a > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/go_kcpgousagemain.go > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/go_main.go > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/iosbin/main.go > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/Kcpgousage.m > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/Kcpgousage.objc.h > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/kcpgousage.h > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/Universe.m > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/Universe.objc.h > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/universe.h > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/seq_darwin.m > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/seq_darwin.go > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/ref.h > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/seq.h > > write > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind/seq.go > > ObjC > > golang.org/x/mobile/internal/mobileinit > > golang.org/x/mobile/bind/seq > > > _/var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/gomobile_bind > > command-line-arguments > > ObjC > > github.com/golang/snappy > > github.com/pkg/errors > > github.com/templexxx/reedsolomon > > github.com/templexxx/xor > > golang.org/x/mobile/internal/mobileinit > > golang.org/x/crypto/blowfish > > golang.org/x/crypto/cast5 > > golang.org/x/crypto/pbkdf2 > > golang.org/x/crypto/salsa20/salsa > > golang.org/x/crypto/tea > > golang.org/x/crypto/twofish > > golang.org/x/crypto/xtea > > golang.org/x/net/bpf > > golang.org/x/net/internal/iana > > golang.org/x/net/internal/socket > > golang.org/x/crypto/salsa20 > > github.com/xtaci/smux > > # golang.org/x/net/internal/socket > > ../../../go/src/golang.org/x/net/internal/socket/cmsghdr.go:9:10: > undefined: cmsghdr > > golang.org/x/mobile/bind/seq > > gomobile: darwin-arm64: go build > -pkgdir=/Users/lining/Documents/GitHub/kcptun/pkg/gomobile/pkg_darwin_arm64 > -tags ios -v -buildmode=c-archive -o > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/kcpgousage-arm64.a > > /var/folders/gq/gxxxlb3d4m19m87vxc3849gm0000gn/T/gomobile-work-068740646/src/iosbin/main.go > > failed: exit status 2 > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.