-
Notifications
You must be signed in to change notification settings - Fork 18k
x/mobile: ld: error: duplicate symbol: display #44121
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
Comments
@dmitshur can you please take a look (I see the latest commit was targeting MacOS, but for arm64; I'm on Intel). |
Do you know if this used to work and if this is a regression, or is the first time you're trying this? Does it also happen with Go 1.15.7 (the previous minor release)? |
I can reproduce this at tip with the main branch on Linux/amd64. I think this is similar to the problem in #42655 -- the C/C++ compiler in the new NDK has changed its default from -fcommon to -fno-common , and the gomobile code needs to take this into account (either by cooking the compiler flags or adding a common attribute). I can try to send a patch if it would help (not sure who owns gomobile). |
See also android/ndk#1409 |
I sent https://go-review.googlesource.com/c/mobile/+/290031 with a tentative fix. |
Change https://golang.org/cl/290031 mentions this issue: |
I tried 1.15.7, but got what I see in the mentioned #42665 I also tried 1.16rc1 - it's just a bit longerANDROID_NDK_HOME=~/Library/Android/sdk/ndk/22.0.7026061 gomobile build -v -target android . generated AndroidManifest.xml: |
Thanks for the hint, @thanm Good news: worked with ndk 21.4.7075529, go1.15.8$ ANDROID_NDK_HOME=~/Library/Android/sdk/ndk/21.4.7075529 gomobile build -v -target android golang.org/x/mobile/example/basic generated AndroidManifest.xml: Resulting basic.apk runs successfully on Android 10 (with a warning at start: "this app was built for an earlier version of Android", but that's at least something I can start with). |
For the Android NDK, between r21 and r22 the NDK compiler switched the default from "-fcommon" to "-fno-common", which causes duplicate definitions when building the examples given the current C code. To fix things, rework the C code to insure that we have a single definition and an "extern" reference to the objects in question. Updates golang/go#44121. Change-Id: If198d5cfd977a7cfd1a37652d3a1916d8c8dbcb7 Reviewed-on: https://go-review.googlesource.com/c/mobile/+/290031 Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Trust: Than McIntosh <[email protected]>
This should be fixed now on tip. Please reopen if not. |
For the Android NDK, between r21 and r22 the NDK compiler switched the default from "-fcommon" to "-fno-common", which causes duplicate definitions when building the examples given the current C code. To fix things, rework the C code to insure that we have a single definition and an "extern" reference to the objects in question. Updates golang/go#44121. Change-Id: If198d5cfd977a7cfd1a37652d3a1916d8c8dbcb7 Reviewed-on: https://go-review.googlesource.com/c/mobile/+/290031 Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Trust: Than McIntosh <[email protected]>
For the Android NDK, between r21 and r22 the NDK compiler switched the default from "-fcommon" to "-fno-common", which causes duplicate definitions when building the examples given the current C code. To fix things, rework the C code to insure that we have a single definition and an "extern" reference to the objects in question. Updates golang/go#44121. Change-Id: If198d5cfd977a7cfd1a37652d3a1916d8c8dbcb7 Reviewed-on: https://go-review.googlesource.com/c/mobile/+/290031 Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Trust: Than McIntosh <[email protected]>
version of Go
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
a built apk
What did you see instead?
go mobile
OutputThe text was updated successfully, but these errors were encountered: