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

build: add support for OpenBSD #2341

Open
anoduck opened this issue Feb 17, 2023 · 3 comments
Open

build: add support for OpenBSD #2341

anoduck opened this issue Feb 17, 2023 · 3 comments

Comments

@anoduck
Copy link

anoduck commented Feb 17, 2023

Pebble is a requirement for httpx, and thus during installation it ejected the following set of errors, which immediately caused the installation to fail.:

# github.com/cockroachdb/pebble/vfs
/go/bin/pkg/mod/github.com/cockroachdb/pebble@v0.0.0-20230207164304-7d1e4ba7ffd0/vfs/disk_usage_unix.go:18:27: stat.Bsize undefined (type unix.Statfs_t has no field or method Bsize)
/go/bin/pkg/mod/github.com/cockroachdb/pebble@v0.0.0-20230207164304-7d1e4ba7ffd0/vfs/disk_usage_unix.go:18:48: stat.Bfree undefined (type unix.Statfs_t has no field or method Bfree)
/go/bin/pkg/mod/github.com/cockroachdb/pebble@v0.0.0-20230207164304-7d1e4ba7ffd0/vfs/disk_usage_unix.go:19:28: stat.Bsize undefined (type unix.Statfs_t has no field or method Bsize)
/go/bin/pkg/mod/github.com/cockroachdb/pebble@v0.0.0-20230207164304-7d1e4ba7ffd0/vfs/disk_usage_unix.go:19:49: stat.Bavail undefined (type unix.Statfs_t has no field or method Bavail)
/go/bin/pkg/mod/github.com/cockroachdb/pebble@v0.0.0-20230207164304-7d1e4ba7ffd0/vfs/disk_usage_unix.go:20:28: stat.Bsize undefined (type unix.Statfs_t has no field or method Bsize)
/go/bin/pkg/mod/github.com/cockroachdb/pebble@v0.0.0-20230207164304-7d1e4ba7ffd0/vfs/disk_usage_unix.go:20:49: stat.Blocks undefined (type unix.Statfs_t has no field or method Blocks)

System: OpenBSD Current 7.2
Go Version: go1.19.4 openbsd/amd64

Any information to further help diagnose the issue would be greatly appreciated.

Jira issue: PEBBLE-128

@nicktrav
Copy link
Contributor

It looks like we don't currently support OpenBSD. However, we do support FreeBSD.

$ GOOS=openbsd go build -o /tmp/pebble ./cmd/pebble
# github.com/cockroachdb/pebble/vfs
vfs/disk_usage_unix.go:18:27: stat.Bsize undefined (type "golang.org/x/sys/unix".Statfs_t has no field or method Bsize)
vfs/disk_usage_unix.go:18:48: stat.Bfree undefined (type "golang.org/x/sys/unix".Statfs_t has no field or method Bfree)
vfs/disk_usage_unix.go:19:28: stat.Bsize undefined (type "golang.org/x/sys/unix".Statfs_t has no field or method Bsize)
vfs/disk_usage_unix.go:19:49: stat.Bavail undefined (type "golang.org/x/sys/unix".Statfs_t has no field or method Bavail)
vfs/disk_usage_unix.go:20:28: stat.Bsize undefined (type "golang.org/x/sys/unix".Statfs_t has no field or method Bsize)
vfs/disk_usage_unix.go:20:49: stat.Blocks undefined (type "golang.org/x/sys/unix".Statfs_t has no field or method Blocks)

$ GOOS=freebsd go build -o /tmp/pebble ./cmd/pebble && echo $?
0

Perhaps we should consider adding support. I'll repurpose this issue slightly to track that work. Thank you for raising!

@nicktrav nicktrav changed the title Install Failed: stat.Bsize undefined | stat.Bfree undefined | stat.Bsize undefined | stat.Bavail undefined build: add support for OpenBSD Feb 17, 2023
@nicktrav
Copy link
Contributor

Looks like on OpenBSD the field names are slightly different.

https://github.com/golang/sys/blob/4fee21c923398823434653737e3d413027fe4cdd/unix/ztypes_openbsd_amd64.go#L79-L103

This shouldn't be too hard to fix. We'll likely just need to add a disk_usage_openbsd.go.

@nicktrav
Copy link
Contributor

nicktrav commented Feb 17, 2023

We should also add a build target for this in our CI pipeline. Perhaps Free and OpenBSD could be part of a CI matrix.

jbowens pushed a commit that referenced this issue Jun 22, 2023
  - Add vfs/disk_usage_openbsd.go to use unix.Statfs with specific
    fields for OpenBSD
  - Fix bug #2341

Signed-off-by: Laurent Cheylus <foxy@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants