go: cmd/go: permission issue building CGO with Go 1.10
What version of Go are you using (go version
)?
1.10
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/<foo>/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/<foo>/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build884921568=/tmp/go-build -gno-record-gcc-switches"
Intel® Xeon® CPU E5-2680
What did you do?
We have been running a go program that access rocksdb (written in c) via cgo, and it has been running fine under go 1.9. However, after upgrading to 1.10, we get the following error:
go build runtime/cgo: open /usr/lib/go-1.10/pkg/linux_amd64/runtime/cgo.a: permission denied
And the permissions of the cgo files:
ls -l /usr/lib/go-1.10/pkg/linux_amd64/runtime/
total 720
-rw-r--r-- 1 root root 93876 Mar 29 23:49 cgo.a
-rw-r--r-- 1 root root 15674 Mar 29 23:49 debug.a
drwxr-xr-x 2 root root 4096 Mar 29 23:49 internal
drwxr-xr-x 3 root root 4096 Mar 29 23:49 pprof
-rw-r--r-- 1 root root 231096 Mar 29 23:49 pprof.a
-rw-r--r-- 1 root root 378548 Mar 29 23:49 race.a
-rw-r--r-- 1 root root 2614 Mar 29 23:49 trace.a
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 28 (19 by maintainers)
Commits related to this issue
- Fixes building kubeapps on ubuntu 18.04 (with golang snap package) see: https://github.com/golang/go/issues/24674 — committed to sameersbn/kubeapps by deleted user 6 years ago
- Fixes building kubeapps on ubuntu 18.04 (with golang snap package) (#333) see: https://github.com/golang/go/issues/24674 — committed to vmware-tanzu/kubeapps by deleted user 6 years ago
- treewide: Avoid go build `-i` Using `-i` in the "go build" arguments with Golang 1.10 on Ubuntu using a snap package results in this error: $ make -C daemon CHECK contrib/scripts/bindata.s... — committed to joestringer/cilium by joestringer 6 years ago
- treewide: Avoid go build `-i` Using `-i` in the "go build" arguments with Golang 1.10 on Ubuntu using a snap package results in this error: $ make -C daemon CHECK contrib/scripts/bindata.s... — committed to cilium/cilium by joestringer 6 years ago
- treewide: Avoid go build `-i` [ upstream commit e542412662b85a1b32bb80043d115e03c9b3b83f ] Using `-i` in the "go build" arguments with Golang 1.10 on Ubuntu using a snap package results in this erro... — committed to cilium/cilium by joestringer 6 years ago
- treewide: Avoid go build `-i` [ upstream commit e542412662b85a1b32bb80043d115e03c9b3b83f ] Using `-i` in the "go build" arguments with Golang 1.10 on Ubuntu using a snap package results in this erro... — committed to cilium/cilium by joestringer 6 years ago
@davecheney So I’ve found out the issue and a possible fix, but don’t know why it only happens after our go upgrade (I don’t have enough details about our go upgrade process yet). Basically when we build the program, we’ve included the
-i
flags forgo build
as well asgo test
, and that somehow tries to recompile cgo and causes the permission issue. After deleting all-i
from our build script, everything works fine now. What’s your thoughts on this?