runtime/cgo: Unable to install Go from source with cgo enabled when using tcc on Alpine in Docker ("-Qunused-arguments") #60010
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
What version of Go are you using (
go version
)?1.20.4 to bootstrap master (a535055).
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
I was experimenting with small build containers for use with Go and I bumped into a problem that I don't feel I understand. It's possibly a bug or possibly something I misunderstood about the documentation.
In short, the documentation on installing Go from source says the following.
This came up as cgo is needed for the race detector:
I find that this doesn't work with tcc in Alpine (in Docker); when I run the all.bash script, the following error is produced.
The same applies when building everything with gcc and then subsequently running (say)
CC=tcc CGO_ENABLED=1 go build -race .
in a directory containing a Go package.
My question, then: are gcc and clang the only supported C compilers? (Separately: does anyone know why cgo is needed for the race detector?)
To reproduce this (as of commit a535055):
I'm aware that, in this single-stage example, installing go via apk pulls in gcc. I'm aware that everything would go away if I could do with gcc or do without cgo. This is purely illustrative.
What did you expect to see?
No errors.
What did you see instead?
Errors.
The text was updated successfully, but these errors were encountered: