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

Closed
orolik opened this issue Oct 13, 2019 · 2 comments

Comments

@orolik
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?

yes

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/golang.org/x/tools/go.mod" 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 gopkg.in/ahmdrz/goinsta.v2

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 gopkg.in/ahmdrz/goinsta.v2 failed: exit status 1
functions and methods must return either zero or one values, and optionally an error
too many result values: func (*gopkg.in/ahmdrz/goinsta.v2.Item).Download(folder 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/libgojni.so gobind failed: exit status 2
gobind
goinsta_android.c:503:1: error: redefinition of 'Java_goinsta_Account_setBiography'
goinsta_android.c:405:1: note: previous definition is here

@hyangah

This comment has been minimized.

Copy link
Contributor

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

https://godoc.org/golang.org/x/mobile/cmd/gobind#hdr-Passing_Go_objects_to_target_languages

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

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
Projects
None yet
5 participants
You can’t perform that action at this time.