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: gomobile fails with linker error #24058

Closed
axet opened this issue Feb 23, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@axet
Copy link

commented Feb 23, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"

What did you do?

trying to compile https://gitlab.com/axet/libtorrent with following error

# github.com/anacrolix/go-libutp
/var/folders/lv/m63vrmx5375dgk4jhc05ww000000gn/T/go-build072150581/b125/_x008.o(.ARM.extab+0x0): error: undefined reference to '__gxx_personality_v0'
/var/folders/lv/m63vrmx5375dgk4jhc05ww000000gn/T/go-build072150581/b125/_x008.o(.ARM.extab+0x38): error: undefined reference to '__gxx_personality_v0'
/var/folders/lv/m63vrmx5375dgk4jhc05ww000000gn/T/go-build072150581/b125/_x008.o(.ARM.extab+0x64): error: undefined reference to '__gxx_personality_v0'
/var/folders/lv/m63vrmx5375dgk4jhc05ww000000gn/T/go-build072150581/b125/_x008.o(.ARM.extab+0x9c): error: undefined reference to '__gxx_personality_v0'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

My first guess this is gomobile issues. According to https://stackoverflow.com/questions/6045809 here something wrong with -lstdcpp definition.

Adding #cgo LDFLAGS: -lstdc++ to the https://github.com/anacrolix/go-libutp/blob/master/utp.go does not solve the issue.

@ALTree ALTree changed the title gomobile failed x/mobile: gomobile fails with linker error Feb 23, 2018

@gopherbot gopherbot added this to the Unreleased milestone Feb 23, 2018

@gopherbot gopherbot added the mobile label Feb 23, 2018

@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Mar 14, 2018

It seems the library doesn't build:

$ CGO_ENABLED=1 CC=<ndk>/clang CXX=<ndk>/clang++ GOOS=android GOARCH=arm go get -u gitlab.com/axet/libtorrent 
# gitlab.com/axet/libtorrent
../dev/go/src/gitlab.com/axet/libtorrent/files.go:52:27: too many arguments in call to t.Files
	have (string)
	want ()
../dev/go/src/gitlab.com/axet/libtorrent/files.go:72:26: t.PieceBytesCompleted undefined (type *torrent.Torrent has no field or method PieceBytesCompleted)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:73:13: t.PieceLength undefined (type *torrent.Torrent has no field or method PieceLength, but does have torrent.pieceLength)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:77:14: t.PieceBytesCompleted undefined (type *torrent.Torrent has no field or method PieceBytesCompleted)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:77:39: t.PieceLength undefined (type *torrent.Torrent has no field or method PieceLength, but does have torrent.pieceLength)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:77:58: t.PieceBytesCompleted undefined (type *torrent.Torrent has no field or method PieceBytesCompleted)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:77:83: t.PieceLength undefined (type *torrent.Torrent has no field or method PieceLength, but does have torrent.pieceLength)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:258:10: t.GetPendingPieces undefined (type *torrent.Torrent has no field or method GetPendingPieces)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:301:3: t.UpdatePiecePriorities undefined (type *torrent.Torrent has no field or method UpdatePiecePriorities, but does have torrent.updatePiecePriorities)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:353:9: t.PieceLength undefined (type *torrent.Torrent has no field or method PieceLength, but does have torrent.pieceLength)
../dev/go/src/gitlab.com/axet/libtorrent/files.go:353:9: too many errors
@axet

This comment has been minimized.

Copy link
Author

commented Mar 14, 2018

I probably should create simple cpp project to test 'undefined reference', 'dev' branch compiles. Since goland does not support version control for imported code those are common complications build success or failed...

I guess you can just run:

 gomobile bind -o "libtorrent.aar" github.com/anacrolix/go-libutp
@gopherbot

This comment has been minimized.

Copy link

commented Mar 15, 2018

Change https://golang.org/cl/99875 mentions this issue: cmd/gomobile: drop init step for build and bind commands

@golang golang locked and limited conversation to collaborators Mar 26, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.