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

cmd/go: build constraints sometimes ineffective for net/cgo_resnew.go on FreeBSD #33101

Open
ohmantics opened this issue Jul 14, 2019 · 5 comments

Comments

@ohmantics
Copy link

commented Jul 14, 2019

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

$ go version
go version go1.12.6 freebsd/amd64

Does this issue reproduce with the latest release?

Yes. (Bumped to 1.12.7 by changing pkg repos over to latest and tried again.)

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/xxx/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH="/home/xxx/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/freebsd_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/home/xxx/Projects/sshcode/go.mod"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build447432705=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Downloaded sshcode and was in progress patching it for FreeBSD. Ran ci/build.sh.

What did you expect to see?

Build success.

What did you see instead?

A few repeats of the below:

# net
/usr/local/go/src/net/cgo_resnew.go:21:87: cannot use _Ctype_uint(len(b)) (type _Ctype_uint) as type _Ctype_ulong in argument to _C2func_getnameinfo
@bcmills

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

The +build constraints on cgo_resnew.go do not appear to allow freebsd: it should be using cgo_resold.go instead.

Can you reproduce this failure using a sequence of go commands rather than the ci/build.sh wrapper?

@bcmills bcmills changed the title Build issue with cgo_resnew.go on FreeBSD net: Build issue with cgo_resnew.go on FreeBSD Jul 15, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

Ah, yeah: ci/build.sh is explicitly cross-compiling, so presumably you don't have the correct C headers for the target platforms.

Cross-compiles don't enable cgo by default, for that exact reason. Do you have CGO_ENABLED explicitly set in your environment? If so, what happens if you unset it?

@cuonglm

This comment has been minimized.

Copy link
Contributor

commented Jul 31, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Jul 31, 2019

@cuonglm, was that a flake, or did you find a workaround?

@cuonglm

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2019

@bcmills it does not seem to be a flake, it occrurred when I cross-compile with cgo enable on freebsd.

In my CL, I change the test to run on Linux only.

@bcmills bcmills removed the WaitingForInfo label Aug 1, 2019

@bcmills bcmills added this to the Go1.14 milestone Aug 1, 2019

@bcmills bcmills changed the title net: Build issue with cgo_resnew.go on FreeBSD cmd/go: build constraints sometimes ineffective for net/cgo_resnew.go on FreeBSD Aug 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.