golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.7k stars 17.49k forks source link

syscall: SYS_SETGROUPS, SYS_SETUID, SYS_SETGID, SYS_DUP2 not available for Solaris (Illumos) #34137

Closed kayront closed 5 years ago

kayront commented 5 years ago

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

$ go version

go version go1.12.5 solaris/amd64

Does this issue reproduce with the latest release?

Possibly.

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

go env Output
$ go env

GOARCH="amd64" GOBIN="" GOCACHE="/home/admin/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="solaris" GOOS="solaris" GOPATH="/home/admin/go" GOPROXY="" GORACE="" GOROOT="/opt/local/go112" GOTMPDIR="" GOTOOLDIR="/opt/local/go112/pkg/tool/solaris_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" 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-build234326747=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Attempted to compile dnscrypt-proxy2.

What did you expect to see?

A shiny binary that works on Solaris.

What did you see instead?

Chaos. Failure. Disappointment.

ithub.com/jedisct1/dnscrypt-proxy/vendor/github.com/miekg/dns
github.com/jedisct1/dnscrypt-proxy/vendor/golang.org/x/net/idna
github.com/jedisct1/dnscrypt-proxy/vendor/golang.org/x/net/http/httpguts
github.com/jedisct1/dnscrypt-proxy/vendor/golang.org/x/net/http2
github.com/jedisct1/dnscrypt-proxy/dnscrypt-proxy
# github.com/jedisct1/dnscrypt-proxy/dnscrypt-proxy
/home/pbulk/build/net/dnscrypt-proxy2/work/src/github.com/jedisct1/dnscrypt-proxy/dnscrypt-proxy/privilege_others.go:53:39: undefined: syscall.SYS_SETGROUPS
/home/pbulk/build/net/dnscrypt-proxy2/work/src/github.com/jedisct1/dnscrypt-proxy/dnscrypt-proxy/privilege_others.go:56:39: undefined: syscall.SYS_SETGID
/home/pbulk/build/net/dnscrypt-proxy2/work/src/github.com/jedisct1/dnscrypt-proxy/dnscrypt-proxy/privilege_others.go:59:39: undefined: syscall.SYS_SETUID
/home/pbulk/build/net/dnscrypt-proxy2/work/src/github.com/jedisct1/dnscrypt-proxy/dnscrypt-proxy/privilege_others.go:70:40: undefined: syscall.SYS_DUP2
/home/pbulk/build/net/dnscrypt-proxy2/work/src/github.com/jedisct1/dnscrypt-proxy/dnscrypt-proxy/privilege_others.go:78:40: undefined: syscall.SYS_DUP2
*** Error code 2
ianlancetaylor commented 5 years ago

The syscall package is inherently system dependent. Those constants are not defined on Solaris. There is no simple approach we can take to fix this. If you want your system-dependent code to build on Solaris, you will need to port it to Solaris. Sorry.