Build failure for GOOS=solaris,illumos,plan9

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

$ go version
1.14

What operating system are you using?

Solars, Illumos, Plan9

What version of Badger are you using?

v2

Does this issue reproduce with the latest master?

Yes

Steps to Reproduce the issue

GOOS=solaris go build
GOOS=illumos go build
GOOS=plan9 go build

What Badger options were set?

n/a

What did you do?

Tried to compile badger

What did you expect to see?

Successful compilation

What did you see instead?

$ GOOS=solaris go build
# github.com/dgraph-io/badger/y
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:57:30: undefined: syscall.SYS_MADVISE

$ GOOS=plan9 go build
# github.com/dgraph-io/badger/y
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/file_dsync.go:24:21: undefined: unix.O_DSYNC
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:32:11: undefined: unix.PROT_READ
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:34:12: undefined: unix.PROT_WRITE
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:36:9: undefined: unix.Mmap
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:36:54: undefined: unix.MAP_SHARED
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:41:9: undefined: unix.Munmap
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:48:11: undefined: unix.MADV_NORMAL
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:50:11: undefined: unix.MADV_RANDOM
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:57:30: undefined: syscall.SYS_MADVISE
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:59:8: cannot use 0 (type untyped int) as type syscall.ErrorString
../../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.5.3/y/mmap_unix.go:59:8: too many errors
# github.com/dgraph-io/badger/v2/y
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/file_dsync.go:24:21: undefined: unix.O_DSYNC
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/mmap_unix.go:30:11: undefined: unix.PROT_READ
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/mmap_unix.go:32:12: undefined: unix.PROT_WRITE
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/mmap_unix.go:34:9: undefined: unix.Mmap
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/mmap_unix.go:34:54: undefined: unix.MAP_SHARED
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/mmap_unix.go:39:9: undefined: unix.Munmap
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/mmap_unix.go:46:11: undefined: unix.MADV_NORMAL
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/mmap_unix.go:48:11: undefined: unix.MADV_RANDOM
../../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200413122845-09dd2e1a4195/y/mmap_unix.go:50:9: undefined: unix.Madvise

Badger is an indirect dependency for Caddy 2, but Badger is not able to compile for Plan9, Illumos, or Solaris, which limits our build targets even though Caddy 2 can typically build for these platforms. This is unfortunate. :frowning:

Some tweaking of the build tags should be able to fix the problem.

Related issue: https://github.com/caddyserver/caddy/issues/3615

The build for plan9 should be fixed by https://github.com/dgraph-io/badger/pull/1451.

I’ll look into the solaris failure.

1 Like

Excellent, thank you! Keep us posted. :+1: It’s totally OK if the functions just return an error on those platforms or something (we probably don’t use those features anyway) – we just want builds to succeed for now.