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: Caddy Build Fails for Solaris/Illumos and Plan9 · Issue #3615 · caddyserver/caddy · GitHub

The build for plan9 should be fixed by Fix build on Plan 9 by fhs · Pull Request #1451 · dgraph-io/badger · GitHub.

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.

@ibrahim Just wanted to know if there is any update. It would be really great to have dgraph working on Illumos/Solaris.

Hey @francescocarzaniga, I don’t have any updates right now. This issue is about fixing badger so that it runs on solaris/illumos/plan9. Running dgraph on these operating systems might be a different challenge altogether (I haven’t tried doing it).

@ibrahim Indeed I meant badger, sorry. I join @mholt in hoping you will keep us posted, as I’m very interested in running Caddy on Illumos. Thank you for the update!