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: JNI library can't find __isoc99_sscanf on Android x86-64 #35441

Closed
bemasc opened this issue Nov 7, 2019 · 2 comments
Closed

x/mobile: JNI library can't find __isoc99_sscanf on Android x86-64 #35441

bemasc opened this issue Nov 7, 2019 · 2 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Android
Milestone

Comments

@bemasc
Copy link
Contributor

bemasc commented Nov 7, 2019

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

$ go version
go version go1.13.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bemasc/.cache/go-build"
GOENV="/usr/local/google/home/bemasc/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bemasc/work"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/google-golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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=/tmp/go-build596314756=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I built an Android app using a Go library and Gomobile. The Go library imports "net/http". When I run the app, it works fine on armv7, arm64, and x86, but it crashes as soon as the JNI module is imported on x86-64. This reproduces both in an x86-64 emulator and on x86-64 Chromebooks (e.g. Pixelbook, Pixel Slate) in the ARC++ environment.

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__isoc99_sscanf" referenced by "/data/app/app.intra-1/lib/x86_64/libgojni.so"...
        at java.lang.Runtime.loadLibrary(Runtime.java:372)
        at java.lang.System.loadLibrary(System.java:1076)
        at go.LoadJNI.<clinit>(LoadJNI.java:23)
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:324)
        at java.lang.Class.forName(Class.java:285)
        at go.Seq.<clinit>(Seq.java:38)
        at go.Seq.touch(Seq.java:55)
        at tun2socks.Tun2socks.<clinit>(Tun2socks.java:11)

__isoc99_sscanf appears to be used by OPENSSL_cpuid_setup, a2i_ipadd, and ipv6_cb. It only appears in the x86-64 library, not any of the other architectures.

@gopherbot gopherbot added this to the Unreleased milestone Nov 7, 2019
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Nov 7, 2019
@bcmills
Copy link
Contributor

bcmills commented Nov 8, 2019

CC @hyangah @steeve

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Android labels Nov 8, 2019
@bemasc
Copy link
Contributor Author

bemasc commented Nov 8, 2019

This was happening because my workstation's copy of go was built from the boringcrypto branch (and apparently this only affected the x86-64 build target). It would be nice if gomobile could separate the target stdlib from the system stdlib, but I wouldn't call that a bug.

@bemasc bemasc closed this as completed Nov 8, 2019
@golang golang locked and limited conversation to collaborators Nov 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Android
Projects
None yet
Development

No branches or pull requests

3 participants