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/mobile/cmd/gomobile: bind -target=ios app.sdk/lightControl fail #31670

Open
orange-jacky opened this issue Apr 25, 2019 · 8 comments
Open

x/mobile/cmd/gomobile: bind -target=ios app.sdk/lightControl fail #31670

orange-jacky opened this issue Apr 25, 2019 · 8 comments
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@orange-jacky
Copy link

orange-jacky commented Apr 25, 2019

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 Output
$ go env

What 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=]

@jdiegodcp
Copy link

Was it working fine before? If so what change did you do to have this issue?

@bradfitz bradfitz changed the title cmd/gomobile gomobile bind -target=ios app.sdk/lightControl fail x/mobile/cmd/gomobile: bind -target=ios app.sdk/lightControl fail Apr 25, 2019
@gopherbot gopherbot added this to the Unreleased milestone Apr 25, 2019
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Apr 25, 2019
@orange-jacky
Copy link
Author

orange-jacky commented Apr 26, 2019

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

@orange-jacky
Copy link
Author

type S struct{
A int8
}

it still works

@triztian
Copy link

triztian commented May 27, 2019

I think only int, int8, int32 and int64 signed integers are supported, byte is an alias to uint8 which is unsigned.

Reference:

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 28, 2019
@bcmills
Copy link
Contributor

bcmills commented May 28, 2019

CC @hyangah

@joshuajiangdev
Copy link

Just wanna check in to see if we have any updates of how to bind a lib contains byte type?

@beansgum
Copy link

beansgum commented Aug 9, 2022

I'm currently experiencing this compilation error when generating a library for ios.

error: unknown type name 'byte'; did you mean 'Byte'?"

I'm able to bypass the error by changing byte to Byte in here and here then I compile gobind and place it in my bin directory, this fixes the error for me.

@triztian
Copy link

triztian commented Aug 9, 2022

Try replacing byte with uint8 in your go code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants