Please answer these questions before submitting your issue. Thanks!
go version)?go version go1.8.3 linux/amd64
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"
cd ${GOPATH}/src/golang.org/x/sys
GOOS=freebsd GOARCH=386 go install ./...
No error
# 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.
the trybots ran OK so I'm a bit puzzled about this.
Breaks compilation of any go package on FBSD i386 too.
the trybots ran OK so I'm a bit puzzled about this.
I filed #21163
According to https://go-review.googlesource.com/c/47290/ the trybots ran OK so I'm a bit puzzled about this.
AFAIK we don't have a freebsd/386 trybot.
Hello. May I claim this issue?
CL https://golang.org/cl/51270 mentions this issue.
@slon, yes, you could've sent a change (no need to ask), but the fix was simple enough that I just sent it.
Change https://golang.org/cl/51570 mentions this issue: unix: re-enable Capsicum on FreeBSD 386
I'm getting this error too @ncw, how did you solve it?
@hacdias just update - it should be fixed now. It is for me any way.
I'm getting this error on Travis though with Go 1.8.3. I'll try to figure out why.
What version of FreeBSD are those with problems running?
In my case it's cross compiling on Ubuntu Trusty on Travis CI.
I guess whatever you're using for cross-compiling is not up-to-date...
I'll check that out, thanks @benlaurie
@hacdias You need to update golang.org/x/sys so go get -u golang.org/x/sys
The build is still broken on freebsd/arm.
export GOOS=freebsd
export GOARCH=arm
go build
# golang.org/x/sys/unix
./cap_freebsd.go:18:23: undefined: CAP_RIGHTS_VERSION_00
./cap_freebsd.go:19:2: const initializer CAP_RIGHTS_VERSION_00 + 2 is not a constant
./cap_freebsd.go:19:23: undefined: CAP_RIGHTS_VERSION_00
./cap_freebsd.go:46:21: undefined: CapRights
./cap_freebsd.go:50:24: undefined: CapRights
./cap_freebsd.go:55:27: undefined: CapRights
./cap_freebsd.go:90:29: undefined: CapRights
./cap_freebsd.go:125:29: undefined: CapRights
./cap_freebsd.go:164:39: undefined: CapRights
./cap_freebsd.go:179:41: undefined: CapRights
./cap_freebsd.go:179:41: too many errors
go test -c
# golang.org/x/sys/unix
./cap_freebsd.go:18:23: undefined: CAP_RIGHTS_VERSION_00
./cap_freebsd.go:19:2: const initializer CAP_RIGHTS_VERSION_00 + 2 is not a constant
./cap_freebsd.go:19:23: undefined: CAP_RIGHTS_VERSION_00
./cap_freebsd.go:46:21: undefined: CapRights
./cap_freebsd.go:50:24: undefined: CapRights
./cap_freebsd.go:55:27: undefined: CapRights
./cap_freebsd.go:90:29: undefined: CapRights
./cap_freebsd.go:125:29: undefined: CapRights
./cap_freebsd.go:164:39: undefined: CapRights
./cap_freebsd.go:179:41: undefined: CapRights
./cap_freebsd.go:179:41: too many errors
Yeah, I get the exact same error on Travis, which always downloads the latest commit of each dependency through go get.
It's also broken on openbsd/arm6:
GOOS=openbsd GOARCH=arm GOARM=6 go build -ldflags='-s -w -X main.version=1.0.4 -X main.commit=1dcb5944c3de638dfa22f8c19728820f33118496 -X main.date=2017-07-31T09:47:18Z' -o dist/openbsd-arm-filemanager/filemanager cmd/filemanager/main.go
travis@d282747cb28c:~/gopath/src/github.com/hacdias/filemanager$ GOOS=openbsd GOARCH=arm GOARM=6 go build -ldflags='-s -w -X main.version=1.0.4 -X main.commit=1dcb5944c3de638dfa22f8c19728820f33118496 -X main.date=2017-07-31T09:47:18Z' -o dist/openbsd-arm-filemanager/filemanager cmd/filemanager/main.go
# golang.org/x/sys/unix
../../../golang.org/x/sys/unix/flock.go:16: undefined: Flock_t
../../../golang.org/x/sys/unix/sockcmsg_unix.go:37: undefined: Cmsghdr
../../../golang.org/x/sys/unix/sockcmsg_unix.go:43: undefined: Cmsghdr
No error without ldflags.
@hacdias,
That's an obviously different issue. Please file a new issue and makes this issue focus on FreeBSD stuff.
I am using goxc, to cross-compile but getting exactly this error, tried to update go get -u golang.org/x/sys/unix but still having the issue, current go version: go version go1.8.3 darwin/amd64 just in case this is the Makefile some output:
$ make compile
/Users/nbari/projects/go/bin/goxc -os="freebsd netbsd openbsd darwin linux windows" -bc="!386"
[goxc:go-vet] 2017/08/03 13:25:33 Task go-vet succeeded
ok github.com/ssh-vault/ssh-vault 3.109s
? github.com/ssh-vault/ssh-vault/cmd/ssh-vault [no test files]
[goxc:go-test] 2017/08/03 13:25:37 Task go-test succeeded
[goxc:go-install] 2017/08/03 13:25:37 Task go-install succeeded
[goxc:xc] 2017/08/03 13:25:37 Parallelizing xc for 9 platforms, using max 3 of 4 processors
# golang.org/x/sys/unix
../../../../../golang.org/x/sys/unix/cap_freebsd.go:18: undefined: CAP_RIGHTS_VERSION_00
../../../../../golang.org/x/sys/unix/cap_freebsd.go:19: undefined: CAP_RIGHTS_VERSION_00
../../../../../golang.org/x/sys/unix/cap_freebsd.go:19: const initializer CAP_RIGHTS_VERSION_00 + 2 is not a constant
../../../../../golang.org/x/sys/unix/cap_freebsd.go:46: undefined: CapRights
../../../../../golang.org/x/sys/unix/cap_freebsd.go:50: undefined: CapRights
../../../../../golang.org/x/sys/unix/cap_freebsd.go:55: undefined: CapRights
../../../../../golang.org/x/sys/unix/cap_freebsd.go:90: undefined: CapRights
../../../../../golang.org/x/sys/unix/cap_freebsd.go:125: undefined: CapRights
../../../../../golang.org/x/sys/unix/cap_freebsd.go:164: undefined: CapRights
../../../../../golang.org/x/sys/unix/cap_freebsd.go:179: undefined: CapRights
../../../../../golang.org/x/sys/unix/cap_freebsd.go:179: too many errors
[goxc:xc] 2017/08/03 13:26:10 'go' returned error: Wait error: exit status 2: # golang.org/x/sys/unix
The problem is goxc doesn't have support for current FreeBSD, it seems.
@benlaurie Hi, thanks for the hint, I just tried with this:
env GOOS=freebsd GOARCH=amd64 make
and is working.
The Capsicum types and constants in x/sys/unix were not generated for freebsd/arm or freebsd/386 in https://golang.org/cl/47290. I fixed the situation for freebsd/386 in https://golang.org/cl/51570 and will try to get a freebsd/arm system set up somewhere to generate them there as well (I didn't manage to generate them using a cross-compile setup).
Change https://golang.org/cl/53639 mentions this issue: unix: fix freebsd/arm build, fix freebsd/386 tests
Change https://golang.org/cl/53691 mentions this issue: unix: fix freebsd/arm build, fix freebsd/{386,arm} tests
Most helpful comment
@hacdias,
That's an obviously different issue. Please file a new issue and makes this issue focus on FreeBSD stuff.