gofrs / flock

Thread-safe file locking library in Go
https://pkg.go.dev/github.com/gofrs/flock
BSD 3-Clause "New" or "Revised" License
578 stars 66 forks source link

Cannot build on Illumos #53

Closed francescocarzaniga closed 4 months ago

francescocarzaniga commented 3 years ago

Trying to build on Illumos results in the following error:

root@build_env:/tmp# go get -u github.com/gofrs/flock
go: downloading golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57
# github.com/gofrs/flock
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:28:22: undefined: syscall.LOCK_EX
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:39:22: undefined: syscall.LOCK_SH
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:57:12: undefined: syscall.Flock
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:67:12: undefined: syscall.Flock
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:97:12: undefined: syscall.Flock
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:97:42: undefined: syscall.LOCK_UN
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:119:21: undefined: syscall.LOCK_EX
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:131:21: undefined: syscall.LOCK_SH
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:151:9: undefined: syscall.Flock
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:151:44: undefined: syscall.LOCK_NB
/root/go/pkg/mod/github.com/gofrs/flock@v0.8.0/flock_unix.go:151:44: too many errors

This seems to present a solution.

theckman commented 3 years ago

@francescocarzaniga I'm personally not very familiar with Illumos, so I presume it doesn't have the same system call capabilities as other systems so the symbols are missing when attempting to build.

Considering that you have a Illumos system, would you have the spare cycles to contribute support for that OS? Alternatively, do you have any personal recommendations for where I could get access to one without having to get some local VM running?

francescocarzaniga commented 3 years ago

@theckman I have a personal server with OmniOS where I could spin up a zone for this, it's not particularly powerful but it should do. AFAIK there are no (affordable, Joyent is quite expensive) cloud solutions.

marcheschi commented 2 years ago

Hi I solved the compilation error by using the environment variable: export GOOS=illumos

so flock is compiling fine. I hope it helps someone. Paolo

ldez commented 4 months ago

Currently flock compiles on Illumos:

$ GOOS=illumos GOARH=amd64 go build
$

So I close this issue.