go: x/sys/unix: Capsicum support breaks freebsd build

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8.3 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ncw/go"
GORACE=""
GOROOT="/opt/go/go1.8"
GOTOOLDIR="/opt/go/go1.8/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build712833005=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

cd ${GOPATH}/src/golang.org/x/sys
GOOS=freebsd GOARCH=386 go install ./...

What did you expect to see?

No error

What did you see instead?

# golang.org/x/sys/unix
unix/cap_freebsd.go:18: undefined: CAP_RIGHTS_VERSION_00
unix/cap_freebsd.go:19: undefined: CAP_RIGHTS_VERSION_00
unix/cap_freebsd.go:19: const initializer CAP_RIGHTS_VERSION_00 + 2 is not a constant
unix/cap_freebsd.go:46: undefined: CapRights
unix/cap_freebsd.go:50: undefined: CapRights
unix/cap_freebsd.go:55: undefined: CapRights
unix/cap_freebsd.go:90: undefined: CapRights
unix/cap_freebsd.go:125: undefined: CapRights
unix/cap_freebsd.go:164: undefined: CapRights
unix/cap_freebsd.go:179: undefined: CapRights
unix/cap_freebsd.go:179: too many errors

I bisected the problem to this commit

https://github.com/golang/sys/commit/7a4fde3fda8ef580a89dbae8138c26041be14299

@benlaurie committed with @ianlancetaylor

According to https://go-review.googlesource.com/c/47290/ the trybots ran OK so I’m a bit puzzled about this.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 25 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@hacdias,

That’s an obviously different issue. Please file a new issue and makes this issue focus on FreeBSD stuff.

Yeah, I get the exact same error on Travis, which always downloads the latest commit of each dependency through go get.

@hacdias You need to update golang.org/x/sys so go get -u golang.org/x/sys

I guess whatever you’re using for cross-compiling is not up-to-date…

I’m getting this error on Travis though with Go 1.8.3. I’ll try to figure out why.

@hacdias just update - it should be fixed now. It is for me any way.