Open orange-jacky opened 5 years ago
Was it working fine before? If so what change did you do to have this issue?
Was it working fine before? If so what change did you do to have this issue?
by add my code one by one, i find that this problem, could you tell me how to fix it?
type S struct{ A byte } macbookpro:Downloads fredlee$ gomobile bind -target=ios golang.org/x/mobile/example/bind/lightControl gomobile: darwin-arm: go build -tags ios -buildmode=c-archive -o /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-389231512/lightControl-arm.a gobind failed: exit status 2 gobind In file included from LightControl_darwin.m:9: /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-389231512/src/gobind/LightControl.objc.h:119:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-389231512/src/gobind/LightControl.objc.h:120:19: error: expected a type LightControl_darwin.m:146:4: error: expected a type LightControl_darwin.m:153:19: error: expected a type LightControl_darwin.m:149:2: error: unknown type name 'byte'; did you mean 'Byte'? /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/usr/include/MacTypes.h:687:41: note: 'Byte' declared here LightControl_darwin.m:149:14: error: use of undeclared identifier 'byte' LightControl_darwin.m:150:9: error: implicit conversion of 'Byte' (aka 'unsigned char') to 'id' is disallowed with ARC LightControl_darwin.m:150:9: error: incompatible integer to pointer conversion returning 'Byte' (aka 'unsigned char') from a function with result type 'id' [-Werror,-Wint-conversion]
meanwhile type S struct{ A [1]byte }
macbookpro:Downloads fredlee$ gomobile bind -target=ios golang.org/x/mobile/example/bind/lightControl
it works
type S struct{ A int8 }
it still works
I think only int
, int8
, int32
and int64
signed integers are supported, byte
is an alias to uint8
which is unsigned.
Reference:
CC @hyangah
Just wanna check in to see if we have any updates of how to bind a lib contains byte
type?
Try replacing byte with uint8 in your go code.
What version of Go are you using (
go version
)?go version go1.12.4 darwin/amd64
Does this issue reproduce with the latest release?
yes, always
What operating system and processor architecture are y, ou using (
go env
)?GOARCH="amd64" GOBIN="/Users/fredlee/Documents/develop/go/workspace/bin" GOCACHE="/Users/fredlee/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/fredlee/Documents/develop/go/workspace" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/go-build760905676=/tmp/go-build -gno-record-gcc-switches -fno-common"
go env
OutputWhat did you do?
What did you expect to see?
macbookpro:lightControl fredlee$ gomobile bind -o android/lightControl.aar -target=android app.sdk/lightControl macbookpro:lightControl fredlee$ gomobile bind -target=ios app.sdk/lightControl
What did you see instead?
macbookpro:lightControl fredlee$ gomobile bind -o android/lightControl.aar -target=android app.sdk/lightControl macbookpro:lightControl fredlee$ gomobile bind -target=ios app.sdk/lightControl gomobile: darwin-arm: go build -tags ios -buildmode=c-archive -o /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/lightControl-arm.a gobind failed: exit status 2 gobind In file included from LightControl_darwin.m:9: /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:87:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:88:22: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:89:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:90:25: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:95:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:96:26: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:99:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:100:22: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:101:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:102:17: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:109:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:110:19: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:111:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:112:19: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:113:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:114:19: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:115:4: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:116:19: error: expected a type /var/folders/34/z2z_vp1573g5014m8k7wys100000gn/T/gomobile-work-626724909/src/gobind/LightControl.objc.h:272:4: error: expected a type fatal error: too many errors emitted, stopping now [-ferror-limit=]