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

MacOS package for Android error: duplicate symbol: x_cgo_inittls #1912

Closed
Gys opened this issue Feb 6, 2021 · 5 comments
Closed

MacOS package for Android error: duplicate symbol: x_cgo_inittls #1912

Gys opened this issue Feb 6, 2021 · 5 comments
Labels
bug Something isn't working OS:macOS Tickets affecting only macOS

Comments

@Gys
Copy link

Gys commented Feb 6, 2021

Describe the bug:

I am on MacOS and want to create a hello world for Android. Doing so I get this error:

go build -buildmode=c-shared -o /var/folders/72/njpsc7xn3sgch_3nx5l_w_yw0000gn/T/gomobile-work-047048936/lib/armeabi-v7a/libsimple.so bitbucket.org/XXXXX/fyne_apps/simple failed: exit status 2
# runtime/cgo
ld: error: duplicate symbol: x_cgo_inittls
>>> defined at gcc_android.c:90
>>>            $WORK/b088/_x003.o:(x_cgo_inittls)
>>> defined at gcc_linux_arm.c:13
>>>            $WORK/b088/_x006.o:(.bss+0x4)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To Reproduce:

Steps to reproduce the behaviour:

I took this code for a first app: https://developer.fyne.io/started/firstapp
Running this works as expected on MacOS itself (great!).
The error comes when I execute this in the same folder:
ANDROID_NDK_HOME=/Users/XXXXX/Library/Android/sdk/ndk/22.0.7026061 fyne package -os android -appID com.example.myapp -icon icon.png

Device (please complete the following information):

  • OS: MacOS 11.1
  • Go version: go1.13.15 darwin/amd64
  • Fyne version: cli version v2.0.0
@Gys Gys added the bug Something isn't working label Feb 6, 2021
@andydotxyz
Copy link
Member

Could this be related to golang/go#42655?

@Gys
Copy link
Author

Gys commented Feb 7, 2021

@andydotxyz Yes, I can confirm the error does not show when I compile with NDK 21.3.6528147

This compiles successfully and produces an apk:
ANDROID_NDK_HOME=/Users/XXXXX/Library/Android/sdk/ndk/21.3.6528147 fyne package -os android -appID com.example.myapp -icon icon.png

@andydotxyz
Copy link
Member

I think there is nothing we can do here, there are fixes upstream in Go that should resolve it...

I believe Go 1.16 RC1 contains the fix. The Go 1.15 backport is slated to be included in Go 1.15.8.

So once those are out an upgrade should fix it. Closing this because I think that is all we can do

@andydotxyz andydotxyz added the OS:macOS Tickets affecting only macOS label Feb 7, 2021
@c1ngular
Copy link

c1ngular commented Feb 20, 2021

i can confirm that fyne package compiles go 1.16 and ndk version 21.3.6528147, but not with 22.0.7026061 .

fyne package -os android -name myapp -appID com.example.myapp -icon Icon.png

  • with ndk version 21.3.6528147 , it compiles , outputs : open myapp.apk: permission denied , and i could not see the apk file in same directory or anywhere else .

  • width ndk 22.0.7026061 , faile and ouput :

`go build -buildmode=c-shared -o /var/folders/pg/x975sgkj1xl1jblfgchdmsw40000gn/T/gomobile-work-893807812/lib/armeabi-v7a/libfyne_demo.so fyne.io/fyne/v2/cmd/fyne_demo failed: exit status 2

ld: error: duplicate symbol: display

defined at android.go:38
$WORK/b175/_x001.o:(display)
defined at android.go:38 (/Users/s1ngular/go/pkg/mod/github.com/fyne-io/mobile@v0.1.2/app/android.go:38)
$WORK/b175/_x002.o:(.bss+0x0)

ld: error: duplicate symbol: surface

defined at android.go:39
$WORK/b175/_x001.o:(surface)
defined at android.go:39 (/Users/s1ngular/go/pkg/mod/github.com/fyne-io/mobile@v0.1.2/app/android.go:39)
$WORK/b175/_x002.o:(.bss+0x4)

ld: error: duplicate symbol: display

defined at android.go:38
$WORK/b175/_x001.o:(display)
defined at android.c:146
$WORK/b175/_x004.o:(.bss+0x18)

ld: error: duplicate symbol: surface

defined at android.go:39
$WORK/b175/_x001.o:(surface)
defined at android.c:147
$WORK/b175/_x004.o:(.bss+0x1C)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

`

@andydotxyz
Copy link
Member

For anyone still experiencing this issue there is another solution!

Fyne has a gomobile-bridge project that maps the gomobile APIs into a Fyne runtime: https://github.com/fyne-io/gomobile-bridge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working OS:macOS Tickets affecting only macOS
Projects
None yet
Development

No branches or pull requests

3 participants