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

cmd/go: go install with -trimpath and muslc (alpine linux) gcc is needed #50311

Closed
jerome-laforge opened this issue Dec 22, 2021 · 4 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@jerome-laforge
Copy link

with -trimpath option with go install with muslc on default alpine linux, the go install doesn't work.
apk add --no-cache build-base can be executed as workaround before (but, we have to do each time on CI).

What version of Go are you using (go version)?

go 1.17.5

What did you do?

on our CI, with alpine linux:

  • go install ./...

What did you see instead?

# runtime/cgo
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH
@jerome-laforge jerome-laforge changed the title cmg/install: with trimpath with muslc (alpine linux) gcc is needed cmd/install: with trimpath with muslc (alpine linux) gcc is needed Dec 22, 2021
@jerome-laforge jerome-laforge changed the title cmd/install: with trimpath with muslc (alpine linux) gcc is needed cmd/install: with -trimpath with muslc (alpine linux) gcc is needed Dec 22, 2021
@jerome-laforge jerome-laforge changed the title cmd/install: with -trimpath with muslc (alpine linux) gcc is needed cmd/install: with -trimpath and muslc (alpine linux) gcc is needed Dec 22, 2021
@dmitshur
Copy link
Contributor

cgo needs a C compiler is needed to build C code, this is working as expected.

If you prefer to disable cgo, you can configure that with the CGO_ENABLED environment option.

If your C compiler command is not "gcc", you can configure cgo to use a different command via the CC environment option.

See https://pkg.go.dev/cmd/go#hdr-Environment_variables for a list of environment variables supported by the go command.

For asking questions, please see https://golang.org/wiki/Questions.

@dmitshur dmitshur added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 22, 2021
@dmitshur dmitshur changed the title cmd/install: with -trimpath and muslc (alpine linux) gcc is needed cmd/go: go install with -trimpath and muslc (alpine linux) gcc is needed Dec 22, 2021
@jerome-laforge
Copy link
Author

Sorry, I didn't give enough information.
There is no CGO in my Go program. It is pure Go.

Futhermore, if I disable -trimpath into cmd line, then the compilation works without gcc.

I think, this issue is related with #37158, isn't it?

More info here from Ian Lance Taylor: https://groups.google.com/g/golang-nuts/c/dsqLZi2mEog/m/3mcMSda-BAAJ

@dmitshur
Copy link
Contributor

I see, thanks for more context.

It seems like we can close this issue as a duplicate of #37158, do you agree?

Note that proposal #47257 has been accepted by now, so that will affect this situation when it is resolved.

@jerome-laforge
Copy link
Author

Thanks for your support and the information.

@golang golang locked and limited conversation to collaborators Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants