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

gomobile bind error #34885

orolik opened this issue Oct 13, 2019 · 2 comments


Copy link

@orolik orolik commented Oct 13, 2019

What version of Go are you using (go version)?

$ go version go1.12.4 darwin/amd64 (and 1.13.1 as well)

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

$ go env GOBIN="" GOCACHE="/Users/X/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/X/go" 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="/users/X/go/src/" 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/39/23b6_7s1155g_128gbrh2pqh0000gn/T/go-build069605921=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I want to created aar file of goinsta lib to use it in android app.
gomobile bind -o aaa.aar

What did you expect to see?

just want to get aaa.aar file created.

What did you see instead?

gomobile: /Users/X/go/bin/gobind -lang=go,java -outdir=/var/folders/39/23b6_7s1155g_128gbrh2pqh0000gn/T/gomobile-work-148722375 failed: exit status 1
functions and methods must return either zero or one values, and optionally an error
too many result values: func (* string, name string) (imgs string, vds string, err error)
and many repeats of that string

after comment function func (item *Item) Download(folder, name string) (imgs, vds string, err error) {

I got the following error:
gomobile: /usr/local/go/bin/go build -buildmode=c-shared -o=/var/folders/39/23b6_7s1155g_128gbrh2pqh0000gn/T/gomobile-work-100820805/android/src/main/jniLibs/armeabi-v7a/ gobind failed: exit status 2
goinsta_android.c:503:1: error: redefinition of 'Java_goinsta_Account_setBiography'
goinsta_android.c:405:1: note: previous definition is here


This comment has been minimized.

Copy link

@hyangah hyangah commented Oct 14, 2019

Based on the error message, I am guessing the setter auto-generated due to the exported field Autograph conflicts with the function name generated from the Account.SetAutograph method.

Is it possible to write a small wrapper package with only the subset of types and functions that need binding, and run gomobile bind or gobind on the wrapping package? Given the limitation of the current gobind, I think that may be more tractable.

@bradfitz bradfitz added the mobile label Oct 14, 2019
@julieqiu julieqiu added this to the Unreleased milestone Oct 15, 2019

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 15, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
5 participants
You can’t perform that action at this time.