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

Update Android build to support Go 1.23 #1255

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

atavism
Copy link
Contributor

@atavism atavism commented Dec 9, 2024

This resolves an issue building Android with Go 1.23.0 and above:

go env -w 'GOPRIVATE=github.com/getlantern/*' && \
	go install golang.org/x/mobile/cmd/gomobile && \
	gomobile init && \
	gomobile bind \
	    -target=android \
		-tags='headless lantern' -o=liblantern-all.aar \
		-androidapi=23 \
		-ldflags="-X github.com/getlantern/lantern-client/internalsdk/common.RevisionDate=20241206.175008 -X github.com/getlantern/lantern-client/internalsdk/common.BuildDate=20241209.051925  -X github.com/getlantern/lantern-client/internalsdk/common.ApplicationVersion=9999.99.99" \
		 \
		github.com/getlantern/lantern-client/internalsdk github.com/getlantern/pathdb/testsupport github.com/getlantern/pathdb/minisql
gomobile: go build -tags headless,lantern -ldflags -X github.com/getlantern/lantern-client/internalsdk/common.RevisionDate=20241206.175008 -X github.com/getlantern/lantern-client/internalsdk/common.BuildDate=20241209.051925  -X github.com/getlantern/lantern-client/internalsdk/common.ApplicationVersion=9999.99.99 -buildmode=c-shared -o=/var/folders/j5/yrnkkcxx6wlcr7h2f574qfjc0000gn/T/gomobile-work-3367332437/android/src/main/jniLibs/armeabi-v7a/libgojni.so ./gobind failed: exit status 1
# gobind/gobind
link: github.com/wlynxg/anet: invalid reference to net.zoneCache

The anet library relies on //go:linkname so we explicitly pass the -checklinkname=0 linker flag here to be able to build Android with Go 1.23 (which deprecated use of it).

See https://github.com/wlynxg/anet/blob/main/README.md#how-to-build-with-go-1230-or-later

@jigar-f
Copy link
Contributor

jigar-f commented Dec 9, 2024

App crash with below, #1253 Use this instead/

 System language code: en_IN
16:22:25.407  E  runtime: newstack at runtime.printlock+0x78 sp=0x4000084a10 stack=[0x4000084000, 0x4000085000]
16:22:25.407  E  runtime: newstack at runtime.printlock+0x78 sp=0x4000084a10 stack=[0x4000084000, 0x4000085000]
16:22:25.407  E  	morebuf={pc:0x78afd752e0 sp:0x4000084a10 lr:0x0}
16:22:25.407  E  	morebuf={pc:0x78afd752e0 sp:0x4000084a10 lr:0x0}
16:22:25.407  E  	sched={pc:0x78afdab848 sp:0x4000084a10 lr:0x78afd752e0 ctxt:0x0}
16:22:25.407  E  	sched={pc:0x78afdab848 sp:0x4000084a10 lr:0x78afd752e0 ctxt:0x0}
16:22:25.408  E  runtime.callbackUpdateSystemStack(0x4000070008, 0x7ff24db6c0, 0x0)
16:22:25.408  E  runtime.callbackUpdateSystemStack(0x4000070008, 0x7ff24db6c0, 0x0)
16:22:25.408  E  	/usr/local/go/src/runtime/cgocall.go:257 +0x90 fp=0x4000084a70 sp=0x4000084a10 pc=0x78afd752e0
16:22:25.408  E  	/usr/local/go/src/runtime/cgocall.go:257 +0x90 fp=0x4000084a70 sp=0x4000084a10 pc=0x78afd752e0
16:22:25.408  E  runtime.cgocallbackg(0x78b0dd4900, 0x7ff24db7b0, 0x0)
16:22:25.408  E  	/usr/local/go/src/runtime/cgocall.go:322 +0x68 fp=0x4000084ac0 sp=0x4000084a70 pc=0x78afd754a8
16:22:25.408  E  runtime.cgocallbackg(0x78b0dd4900, 0x7ff24db7b0, 0x0)
16:22:25.408  E  	<autogenerated>:1 +0x1c fp=0x4000084af0 sp=0x4000084ac0 pc=0x78afdef7dc
16:22:25.408  E  runtime.cgocallbackg(0x78b0dd4900, 0x7ff24db7b0, 0x0)
16:22:25.408  E  runtime.cgocallback(0x4000084b68, 0x78b0da8594, 0x78b0de09e0)
16:22:25.408  E  	/usr/local/go/src/runtime/cgocall.go:322 +0x68 fp=0x4000084ac0 sp=0x4000084a70 pc=0x78afd754a8
16:22:25.408  E  runtime.cgocallbackg(0x78b0dd4900, 0x7ff24db7b0, 0x0)
16:22:25.408  E  	<autogenerated>:1 +0x1c fp=0x4000084af0 sp=0x4000084ac0 pc=0x78afdef7dc
16:22:25.408  E  	/usr/local/go/src/runtime/asm_arm64.s:1131 +0xb0 fp=0x4000084b20 sp=0x4000084af0 pc=0x78afded730
16:22:25.408  E  runtime.cgocallback(0x4000084b68, 0x78b0da8594, 0x78b0de09e0)
16:22:25.408  E  runtime.systemstack_switch()
16:22:25.408  E  	/usr/local/go/src/runtime/asm_arm64.s:1131 +0xb0 fp=0x4000084b20 sp=0x4000084af0 pc=0x78afded730
16:22:25.408  E  runtime.systemstack_switch()
16:22:25.409  E  	/usr/local/go/src/runtime/asm_arm64.s:201 +0x8 fp=0x4000084b30 sp=0x4000084b20 pc=0x78afdeb2f8
16:22:25.409  E  	/usr/local/go/src/runtime/asm_arm64.s:201 +0x8 fp=0x4000084b30 sp=0x4000084b20 pc=0x78afdeb2f8
16:22:25.409  E  runtime.cgocall(0x78b0de09e0, 0x4000084ba8)
16:22:25.409  E  runtime.cgocall(0x78b0de09e0, 0x4000084ba8)
16:22:25.409  E  	/usr/local/go/src/runtime/cgocall.go:185 +0x70 fp=0x4000084b70 sp=0x4000084b30 pc=0x78afdde1a0
16:22:25.409  E  	/usr/local/go/src/runtime/cgocall.go:185 +0x70 fp=0x4000084b70 sp=0x4000084b30 pc=0x78afdde1a0
16:22:25.409  E  main._Cfunc_cproxyminisql_DB_Exec(0x2a, {0x7a2a448e50, 0xc8, {0x0, 0x0, 0x0, 0x0}}, 0xffffffe7)
16:22:25.409  E  main._Cfunc_cproxyminisql_DB_Exec(0x2a, {0x7a2a448e50, 0xc8, {0x0, 0x0, 0x0, 0x0}}, 0xffffffe7)
16:22:25.409  E  	_cgo_gotypes.go:1649 +0x34 fp=0x4000084ba0 sp=0x4000084b70 pc=0x78b0da8594
16:22:25.409  E  	_cgo_gotypes.go:1649 +0x34 fp=0x4000084ba0 sp=0x4000084b70 pc=0x78b0da8594
16:22:25.409  E  main.(*proxyminisql_DB).Exec.func1(0x40004000b0, {0x7a2a448e50, 0xc8, {0x0, 0x0, 0x0, 0x0}}, 0xffffffe7)
16:22:25.409  E  main.(*proxyminisql_DB).Exec.func1(0x40004000b0, {0x7a2a448e50, 0xc8, {0x0, 0x0, 0x0, 0x0}}, 0xffffffe7)
16:22:25.409  E  	/private/var/folders/v0/7k3mc29n0g3g_t5kw4fpp0yc0000gn/T/gomobile-work-2885968137/src-android-arm64/gobind/go_minisqlmain.go:584 +0x84 fp=0x4000084c00 sp=0x4000084ba0 pc=0x78b0dc0814
16:22:25.409  E  	/private/var/folders/v0/7k3mc29n0g3g_t5kw4fpp0yc0000gn/T/gomobile-work-2885968137/src-android-arm64/gobind/go_minisqlmain.go:584 +0x84 fp=0x4000084c00 sp=0x4000084ba0 pc=0x78b0dc0814
16:22:25.409  E  main.(*proxyminisql_DB).Exec(0x40004000b0, {0x4000112230?, 0x10?}, {0x78b13bdca8, 0x40002c81f8})
16:22:25.409  E  main.(*proxyminisql_DB).Exec(0x40004000b0, {0x4000112230?, 0x10?}, {0x78b13bdca8, 0x40002c81f8})
16:22:25.409  E  	/private/var/folders/v0/7k3mc29n0g3g_t5kw4fpp0yc0000gn/T/gomobile-work-2885968137/src-android-arm64/gobind/go_minisqlmain.go:584 +0x7c fp=0x4000084c50 sp=0x4000084c00 pc=0x78b0dc068c
16:22:25.409  E  	/private/var/folders/v0/7k3mc29n0g3g_t5kw4fpp0yc0000gn/T/gomobile-work-2885968137/src-android-arm64/gobind/go_minisqlmain.go:584 +0x7c fp=0x4000084c50 sp=0x4000084c00 pc=0x78b0dc068c
16:22:25.409  E  github.com/getlantern/pathdb/minisql.(*QueryableAPI).Exec(0x4000296320, {0x4000112230, 0x64}, {0x0?, 0x1?, 0x78afd87658?})
16:22:25.409  E  github.com/getlantern/pathdb/minisql.(*QueryableAPI).Exec(0x4000296320, {0x4000112230, 0x64}, {0x0?, 0x1?, 0x78afd87658?})
16:22:25.409  E  	/Users/jigarfumakiya/go/pkg/mod/github.com/getlantern/[email protected]/minisql/api.go:14 +0x6c fp=0x4000084c90 sp=0x4000084c50 pc=0x78b0bb5b7c
16:22:25.409  E  	/Users/jigarfumakiya/go/pkg/mod/github.com/getlantern/[email protected]/minisql/api.go:14 +0x6c fp=0x4000084c90 sp=0x4000084c50 pc=0x78b0bb5b7c
16:22:25.409  E  github.com/getlantern/pathdb.NewDB({0x78b13c74c8, 0x40004000b0}, {0x78af9dfda7, 0x3})
16:22:25.409  E  github.com/getlantern/pathdb.NewDB({0x78b13c74c8, 0x40004000b0}, {0x78af9dfda7, 0x3})
16:22:25.409  E  	/Users/jigarfumakiya/go/pkg/mod/github.com/getlantern/[email protected]/db.go:125 +0x14c fp=0x4000084d70 sp=0x4000084c90 pc=0x78b0bba69c
16:22:25.409  E  	/Users/jigarfumakiya/go/pkg/mod/github.com/getlantern/[email protected]/db.go:125 +0x14c fp=0x4000084d70 sp=0x4000084c90 pc=0x78b0bba69c
16:22:25.409  E  github.com/getlantern/lantern-client/internalsdk.newModel({0x78af9dfda7, 0x3}, {0x78b13c74c8?, 0x40004000b0?})
16:22:25.409  E  github.com/getlantern/lantern-client/internalsdk.newModel({0x78af9dfda7, 0x3}, {0x78b13c74c8?, 0x40004000b0?})
16:22:25.409  E  	/Users/jigarfumakiya/Documents/getlantern/mobile_app/lantern-client/internalsdk/model.go:87 +0x44 fp=0x4000084db0 sp=0x4000084d70 pc=0x78b0d79dc4
16:22:25.409  E  	/Users/jigarfumakiya/Documents/getlantern/mobile_app/lantern-client/internalsdk/model.go:87 +0x44 fp=0x4000084db0 sp=0x4000084d70 pc=0x78b0d79dc4
16:22:25.409  E  github.com/getlantern/lantern-client/internalsdk.NewVPNModel({0x78b13c74c8?, 0x40004000b0?})
16:22:25.409  E  github.com/getlantern/lantern-client/internalsdk.NewVPNModel({0x78b13c74c8?, 0x40004000b0?})
16:22:25.409  E  	/Users/jigarfumakiya/Documents/getlantern/mobile_app/lantern-client/internalsdk/vpn_model.go:27 +0x38 fp=0x4000084df0 sp=0x4000084db0 pc=0x78b0d94498
16:22:25.409  E  	/Users/jigarfumakiya/Documents/getlantern/mobile_app/lantern-client/internalsdk/vpn_model.go:27 +0x38 fp=0x4000084df0 sp=0x4000084db0 pc=0x78b0d94498
16:22:25.409  E  main.proxyinternalsdk__NewVPNModel(0x2a)
16:22:25.409  E  main.proxyinternalsdk__NewVPNModel(0x2a)
16:22:25.409  E  	/private/var/folders/v0/7k3mc29n0g3g_t5kw4fpp0yc0000gn/T/gomobile-work-2885968137/src-android-arm64/gobind/go_internalsdkmain.go:4720 +0x64 fp=0x4000084e40 sp=0x4000084df0 pc=0x78b0dbde64
16:22:25.409  E  	/private/var/folders/v0/7k3mc29n0g3g_t5kw4fpp0yc0000gn/T/gomobile-work-2885968137/src-android-arm64/gobind/go_internalsdkmain.go:4720 +0x64 fp=0x4000084e40 sp=0x4000084df0 pc=0x78b0dbde64
16:22:25.409  E  _cgoexp_44039f0b4376_proxyinternalsdk__NewVPNModel(0x7ff24dd000)
16:22:25.409  E  _cgoexp_44039f0b4376_proxyinternalsdk__NewVPNModel(0x7ff24dd000)
16:22:25.409  E  	_cgo_gotypes.go:5222 +0x28 fp=0x4000084e60 sp=0x4000084e40 pc=0x78b0dd3168
16:22:25.409  E  	_cgo_gotypes.go:5222 +0x28 fp=0x4000084e60 sp=0x4000084e40 pc=0x78b0dd3168
16:22:25.409  E  runtime.cgocallbackg1(0x78b0dd3140, 0x7ff24dd000, 0x0)
16:22:25.409  E  runtime.cgocallbackg1(0x78b0dd3140, 0x7ff24dd000, 0x0)
16:22:25.410  E  	/usr/local/go/src/runtime/cgocall.go:442 +0x21c fp=0x4000084f30 sp=0x4000084e60 pc=0x78afd757dc
16:22:25.410  E  	/usr/local/go/src/runtime/cgocall.go:442 +0x21c fp=0x4000084f30 sp=0x4000084e60 pc=0x78afd757dc
16:22:25.410  E  runtime.cgocallbackg(0x78b0dd3140, 0x7ff24dd000, 0x0)
16:22:25.410  E  runtime.cgocallbackg(0x78b0dd3140, 0x7ff24dd000, 0x0)
16:22:25.410  E  	/usr/local/go/src/runtime/cgocall.go:361 +0xf4 fp=0x4000084f80 sp=0x4000084f30 pc=0x78afd75534
16:22:25.410  E  	/usr/local/go/src/runtime/cgocall.go:361 +0xf4 fp=0x4000084f80 sp=0x4000084f30 pc=0x78afd75534
16:22:25.410  E  runtime.cgocallbackg(0x78b0dd3140, 0x7ff24dd000, 0x0)
16:22:25.410  E  runtime.cgocallbackg(0x78b0dd3140, 0x7ff24dd000, 0x0)
16:22:25.410  E  	<autogenerated>:1 +0x1c fp=0x4000084fb0 sp=0x4000084f80 pc=0x78afdef7dc
16:22:25.410  E  	<autogenerated>:1 +0x1c fp=0x4000084fb0 sp=0x4000084f80 pc=0x78afdef7dc
16:22:25.410  E  runtime.cgocallback(0x0, 0x0, 0x0)
16:22:25.410  E  runtime.cgocallback(0x0, 0x0, 0x0)
16:22:25.410  E  	/usr/local/go/src/runtime/asm_arm64.s:1131 +0xb0 fp=0x4000084fe0 sp=0x4000084fb0 pc=0x78afded730
16:22:25.410  E  	/usr/local/go/src/runtime/asm_arm64.s:1131 +0xb0 fp=0x4000084fe0 sp=0x4000084fb0 pc=0x78afded730
16:22:25.410  E  runtime.goexit({})
16:22:25.410  E  runtime.goexit({})
16:22:25.410  E  	/usr/local/go/src/runtime/asm_arm64.s:1223 +0x4 fp=0x4000084fe0 sp=0x4000084fe0 pc=0x78afded824
16:22:25.410  E  	/usr/local/go/src/runtime/asm_arm64.s:1223 +0x4 fp=0x4000084fe0 sp=0x4000084fe0 pc=0x78afded824
16:22:25.410  E  fatal error: runtime: stack split at bad time

@atavism atavism marked this pull request as draft December 9, 2024 17:17
@atavism atavism force-pushed the atavism/go-1.23-android branch from b87e860 to 0929ae0 Compare December 11, 2024 16:34
@atavism
Copy link
Contributor Author

atavism commented Dec 11, 2024

@jigar-f I'm still looking at this one. Can you check if getlantern/pathdb#7 resolves the "stack split at bad time" error for you?

@atavism atavism requested review from jigar-f and garmr-ulfr and removed request for jigar-f December 11, 2024 16:43
@atavism atavism marked this pull request as ready for review December 11, 2024 16:43
@atavism atavism requested a review from myleshorton December 11, 2024 16:43
@jigar-f
Copy link
Contributor

jigar-f commented Dec 12, 2024

@atavism Even with new pathDb changes, it is crashing for me, Does it work for you?

@jigar-f
Copy link
Contributor

jigar-f commented Dec 12, 2024

@atavism I think this is the main issue golang/go#68760

@jigar-f
Copy link
Contributor

jigar-f commented Dec 17, 2024

@atavism Do we still need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants