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

misc/cgo/testcshared: TestGo2C2Go fails on some Android systems #29087

Open
ianlancetaylor opened this issue Dec 3, 2018 · 2 comments
Open

misc/cgo/testcshared: TestGo2C2Go fails on some Android systems #29087

ianlancetaylor opened this issue Dec 3, 2018 · 2 comments

Comments

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Dec 3, 2018

android/arm64: https://build.golang.org/log/09e1a4ff3ef9aa281563ad09ca97456f76947b13:

--- FAIL: TestGo2C2Go (3.18s)
    cshared_test.go:622: run: [go build -buildmode=c-shared -o /var/folders/f6/d2bhfqss2716nxm8gkv1fmb80000gn/T/cshared-TestGo2C2Go159080790/libtestgo2c2go.so go2c2go/go]
    cshared_test.go:647: command failed: [go build -o /var/folders/f6/d2bhfqss2716nxm8gkv1fmb80000gn/T/cshared-TestGo2C2Go159080790/m1 go2c2go/m1]
        exit status 2
        # go2c2go/m1
        /Users/elias/android-ndk-standalone-arm64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: liblog.so, needed by /var/folders/f6/d2bhfqss2716nxm8gkv1fmb80000gn/T/cshared-TestGo2C2Go159080790/libtestgo2c2go.so, not found (try using -rpath or -rpath-link)
        /var/folders/f6/d2bhfqss2716nxm8gkv1fmb80000gn/T/cshared-TestGo2C2Go159080790/libtestgo2c2go.so: undefined reference to `__android_log_vprint'
        clang38: error: linker command failed with exit code 1 (use -v to see invocation)

android/386: https://build.golang.org/log/4e90ced0da91bfcfa07b3acced63beea3829d137:

--- FAIL: TestGo2C2Go (4.11s)
    cshared_test.go:622: run: [go build -buildmode=c-shared -o /var/folders/f6/d2bhfqss2716nxm8gkv1fmb80000gn/T/cshared-TestGo2C2Go737454438/libtestgo2c2go.so go2c2go/go]
    cshared_test.go:647: run: [go build -o /var/folders/f6/d2bhfqss2716nxm8gkv1fmb80000gn/T/cshared-TestGo2C2Go737454438/m1 go2c2go/m1]
    cshared_test.go:195: adb command failed: exit status 127
        /system/bin/sh: /var/folders/f6/d2bhfqss2716nxm8gkv1fmb80000gn/T/cshared-TestGo2C2Go737454438/m1: not found
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 3, 2018

Change https://golang.org/cl/152162 mentions this issue: misc/cgo/testcshared: skip TestGo2C2Go on Android

gopherbot pushed a commit that referenced this issue Dec 3, 2018
Updates #29087

Change-Id: I0bab45818119176c2ba5de9c0e457b7717485d6f
Reviewed-on: https://go-review.googlesource.com/c/152162
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@eliasnaur
Copy link
Contributor

@eliasnaur eliasnaur commented Dec 4, 2018

I took a look. The first problem was that the m1 and m2 executables were not pushed to the device, and neither was their dependency library, libtestgo2c2go.so. However, even after hacking around that, the test failed with runtime/cgo: pthread_key_create failed. That makes sense: on Android, the Go runtime uses a hardcoded offset from %gs for storing the current g, which means that two instances of the runtime cannot coexist in the same process.
In short, this issue is the Android version of #29061 .

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.