Scott Kurz
Scott Kurz

Reputation: 5320

Go build: cgo fork/exec permission denied error

With a Go command like:

$ go build -mod=vendor -ldflags="-X github.com/openshift/odo/pkg/version.GITCOMMIT=40a90e175" cmd/odo/odo.go

I'm getting an error like:

# runtime/cgo
fork/exec /c: permission denied

but none of the solutions mention TMPDIR in Go fork/exec permission denied error seem to work?

Upvotes: 2

Views: 1398

Answers (1)

Scott Kurz
Scott Kurz

Reputation: 5320

In my case, I had environment variable CC exported, set to /c without realizing it was a special variable to cgo.

Unsetting the CC variable solved my problem:

unset CC

Upvotes: 2

Related Questions