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

golang: linker problem on build #6183

Closed
emuvi opened this issue Dec 27, 2020 · 5 comments
Closed

golang: linker problem on build #6183

emuvi opened this issue Dec 27, 2020 · 5 comments
Labels
bug report Something is not working properly.

Comments

@emuvi
Copy link

emuvi commented Dec 27, 2020

On build a GoLang simple project Iˋm getting this error:

runtime/cgo
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: $WORK/b057/_x006.o:/data/data/com.termux/files/usr/lib/go/src/runtime/cgo/gcc_linux_arm64.c:15: multiple definition of `x_cgo_inittls'; $WORK/b057/_x003.o:/data/data/com.termux/files/usr/lib/go/src/runtime/cgo/gcc_android.c:80: first defined here
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

On a simple Hello World it builds, but when I import the package net/http stops to build.

command used:
go build

also happens on:
go test

@ghost ghost transferred this issue from termux/termux-app Dec 27, 2020
@landfillbaby
Copy link
Member

landfillbaby commented Dec 27, 2020

might be related to #6174?

@ghost
Copy link

ghost commented Dec 27, 2020

@landfillbaby Very unlikely. #6174 is a draft and is not merged.

However clang was recently updated to 11.

@RossComputerGuy
Copy link
Contributor

Maybe look at how x_cgo_inittls is defined/used in /data/data/com.termux/files/usr/lib/go/src/runtime/cgo/gcc_linux_arm64.c and /data/data/com.termux/files/usr/lib/go/src/runtime/cgo/gcc_android.c

@ghost ghost changed the title Linker problem on build golang: linker problem on build Dec 28, 2020
@ghost ghost added the bug report Something is not working properly. label Dec 28, 2020
ghost pushed a commit that referenced this issue Dec 28, 2020
@ghost
Copy link

ghost commented Dec 28, 2020

Fixed by 20f7ae7 + 533e798.

P.S. You can even workaround it manually, until updated golang package will be available for installation. Just edit /data/data/com.termux/files/usr/lib/go/src/runtime/cgo/gcc_linux_arm64.c by adding extern to definition of x_cgo_inittls.

@ghost ghost closed this as completed Dec 28, 2020
@emuvi
Copy link
Author

emuvi commented Dec 29, 2020

Thanks!

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug report Something is not working properly.
Projects
None yet
Development

No branches or pull requests

3 participants