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

x/sys/unix: Capsicum support breaks freebsd build #21136

Closed
ncw opened this issue Jul 23, 2017 · 25 comments
Closed

x/sys/unix: Capsicum support breaks freebsd build #21136

ncw opened this issue Jul 23, 2017 · 25 comments

Comments

@ncw
Copy link
Contributor

ncw commented Jul 23, 2017

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

golang/sys@7a4fde3

@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.

@gopherbot gopherbot added this to the Unreleased milestone Jul 23, 2017
ncw added a commit to rclone/rclone that referenced this issue Jul 23, 2017
@mikioh mikioh changed the title x/sys: Compile broken for freebsd/386 x/sys/unix: broken for freebsd/{arm,386} Jul 25, 2017
@agilob
Copy link

agilob commented Jul 25, 2017

the trybots ran OK so I'm a bit puzzled about this.

Breaks compilation of any go package on FBSD i386 too.

@bradfitz
Copy link
Contributor

the trybots ran OK so I'm a bit puzzled about this.

I filed #21163

@ALTree
Copy link
Member

ALTree commented Jul 25, 2017

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.

@slon
Copy link
Contributor

slon commented Jul 26, 2017

Hello. May I claim this issue?

@gopherbot
Copy link

CL https://golang.org/cl/51270 mentions this issue.

@bradfitz
Copy link
Contributor

@slon, yes, you could've sent a change (no need to ask), but the fix was simple enough that I just sent it.

ncw added a commit to rclone/rclone that referenced this issue Jul 26, 2017
tklauser added a commit to tklauser/sys that referenced this issue Jul 27, 2017
Capsicum support was added by https://golang.org/cl/47290, but oinly for
amd64. This broke the freebsd/386 build which was subsequently fixed by
http://golang.org/cl/51270. However, even with this fix the tests still
fail to build due to the missing Cap* functions and types.

Fix the build/test on FreeBSD 386 for real by re-running mkall.sh to get
all the Capsicum functions and types.

Updates golang/go#21136

Change-Id: I54fe2c4567674b07dedad677756369a43a1f0ef6
@gopherbot
Copy link

Change https://golang.org/cl/51570 mentions this issue: unix: re-enable Capsicum on FreeBSD 386

tklauser added a commit to tklauser/sys that referenced this issue Jul 28, 2017
Capsicum support was added by https://golang.org/cl/47290, but only for
amd64. This broke the freebsd/386 build which was subsequently fixed by
http://golang.org/cl/51270. However, even with this fix the tests still
fail to build due to the missing Capsicum functions and types.

Fix the build/test on freebsd/386 for real by re-running mkall.sh on
FreeBSD 11.1-RELEASE (inside VirtualBox) to get all the Capsicum
functions and types.

Some zerrors constants were removed or converted to enums in the FreeBSD
headers. Manually move them to a dedicated file. Do the same for amd64,
where these constants were removed by accident in
https://golang.org/cl/47290.

Updates golang/go#21136

Change-Id: I54fe2c4567674b07dedad677756369a43a1f0ef6
gopherbot pushed a commit to golang/sys that referenced this issue Jul 28, 2017
Capsicum support was added by https://golang.org/cl/47290, but only for
amd64. This broke the freebsd/386 build which was subsequently fixed by
http://golang.org/cl/51270. However, even with this fix the tests still
fail to build due to the missing Capsicum functions and types.

Fix the build/test on freebsd/386 for real by re-running mkall.sh on
FreeBSD 11.1-RELEASE (inside VirtualBox) to get all the Capsicum
functions and types.

Some zerrors constants were removed or converted to enums in the FreeBSD
headers. Manually move them to a dedicated file. Do the same for amd64,
where these constants were removed by accident in
https://golang.org/cl/47290.

Updates golang/go#21136

Change-Id: I54fe2c4567674b07dedad677756369a43a1f0ef6
Reviewed-on: https://go-review.googlesource.com/51570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@hacdias
Copy link

hacdias commented Jul 29, 2017

I'm getting this error too @ncw, how did you solve it?

@ncw
Copy link
Contributor Author

ncw commented Jul 29, 2017

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

@hacdias
Copy link

hacdias commented Jul 30, 2017

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

@benlaurie
Copy link

What version of FreeBSD are those with problems running?

@hacdias
Copy link

hacdias commented Jul 30, 2017

In my case it's cross compiling on Ubuntu Trusty on Travis CI.

@benlaurie
Copy link

I guess whatever you're using for cross-compiling is not up-to-date...

@hacdias
Copy link

hacdias commented Jul 30, 2017

I'll check that out, thanks @benlaurie

@ncw
Copy link
Contributor Author

ncw commented Jul 30, 2017

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

@mikioh
Copy link
Contributor

mikioh commented Jul 31, 2017

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

@mikioh mikioh reopened this Jul 31, 2017
@hacdias
Copy link

hacdias commented Jul 31, 2017

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

@hacdias
Copy link

hacdias commented Jul 31, 2017

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.

@mikioh mikioh changed the title x/sys/unix: broken for freebsd/{arm,386} x/sys/unix: Capsicum support breaks freebsd build Jul 31, 2017
@mikioh
Copy link
Contributor

mikioh commented Aug 1, 2017

@hacdias,

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

@nbari
Copy link

nbari commented Aug 3, 2017

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

@benlaurie
Copy link

The problem is goxc doesn't have support for current FreeBSD, it seems.

@nbari
Copy link

nbari commented Aug 3, 2017

@benlaurie Hi, thanks for the hint, I just tried with this:

env GOOS=freebsd GOARCH=amd64 make  

and is working.

@tklauser
Copy link
Member

tklauser commented Aug 4, 2017

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).

@gopherbot
Copy link

Change https://golang.org/cl/53639 mentions this issue: unix: fix freebsd/arm build, fix freebsd/386 tests

@gopherbot
Copy link

Change https://golang.org/cl/53691 mentions this issue: unix: fix freebsd/arm build, fix freebsd/{386,arm} tests

micanzhang pushed a commit to micanzhang/sys that referenced this issue Sep 12, 2017
It was broken by https://golang.org/cl/47290

Fixes golang/go#21136

Change-Id: I2a08869fd44a9776f0dc7d461814e1df4e606b5d
Reviewed-on: https://go-review.googlesource.com/51270
Reviewed-by: Ian Lance Taylor <iant@golang.org>
micanzhang pushed a commit to micanzhang/sys that referenced this issue Sep 12, 2017
Capsicum support was added by https://golang.org/cl/47290, but only for
amd64. This broke the freebsd/386 build which was subsequently fixed by
http://golang.org/cl/51270. However, even with this fix the tests still
fail to build due to the missing Capsicum functions and types.

Fix the build/test on freebsd/386 for real by re-running mkall.sh on
FreeBSD 11.1-RELEASE (inside VirtualBox) to get all the Capsicum
functions and types.

Some zerrors constants were removed or converted to enums in the FreeBSD
headers. Manually move them to a dedicated file. Do the same for amd64,
where these constants were removed by accident in
https://golang.org/cl/47290.

Updates golang/go#21136

Change-Id: I54fe2c4567674b07dedad677756369a43a1f0ef6
Reviewed-on: https://go-review.googlesource.com/51570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
micanzhang pushed a commit to micanzhang/sys that referenced this issue Sep 12, 2017
Re-run mkall.sh on FreeBSD-11.1-RELEASE armv6 for Capsicum consts and
POSIX.1-2008 path relative *at() syscalls.

Add errors_freebsd_arm.go generated semi-automatically using:
https://gist.github.com/paulzhol/c6d54dc2baf2a6bd204b343a15459661
Similar to https://golang.org/cl/51570. In order to handle C enum based
constants that mkerrors.sh missed.

Use fix from https://golang.org/cl/53639 to run Capsicum tests only on amd64.

Fixes golang/go#21136

Change-Id: I9681b033531090e6b1c5e2446a442deb39cf3066
Reviewed-on: https://go-review.googlesource.com/53691
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Aug 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests