-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/cgo: jobject is not mapped to uintptr if building with the Android NDK #26213
Comments
I'm marking this release-blocker since it causes crashes in the wild. |
CC @randall77 who did CL 81876. |
Here is a stack trace:
|
This is how
|
This check then fails: |
We have a fix that we'll upstream today or tomorrow if you guys want: https://github.com/znly/go/commit/6319b41464636ec173958c08b4b39611c677bb0e That said, I fail to understand why |
I think test22906 uses its own definition of JNI types to avoid depending on jni.h. |
Ah you're right. |
This is a candidate for back-porting as well. |
After fighting with the auth on Gerrit, I bailed and submitted a PR at #26221 |
Change https://golang.org/cl/122217 mentions this issue: |
What version of Go are you using (
go version
)?go version devel +36c623046b Wed Jul 4 00:22:11 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
With tip.
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/home/elias/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/elias/dev/go"
GOPROXY=""
GORACE=""
GOROOT="/home/elias/dev/go-tip"
GOTMPDIR=""
GOTOOLDIR="/home/elias/dev/go-tip/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build267724991=/tmp/go-build -gno-record-gcc-switches"
VGOMODROOT=""
What did you do?
Compiled the program
with the Android NDK:
$ CC=/path/to/ndk-standalone-x86_64/bin/clang CGO_ENABLED=1 GOOS=android go build program.go
What did you expect to see?
No error.
What did you see instead?
The short program is a condensed version of the gomobile internal/mobileinit/ctx_android.go file. There is no direct assignment to a jobject variables in gomobile; I found out because I was alerted to a write barrier related crash in the function SetContext that operates on jobject values.
Note that the program successfully builds with my system's JNI headers:
$ CGO_CFLAGS="-I/usr/lib/jvm/java/include/ -I/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.172-9.b11.fc28.x86_64/include/linux" CGO_ENABLED=1 go build program.go
The text was updated successfully, but these errors were encountered: