Skip to content

OpenBSD: Fix remaining build issues#1942

Open
tobhe wants to merge 2 commits intoSmithay:masterfrom
tobhe:eventfd
Open

OpenBSD: Fix remaining build issues#1942
tobhe wants to merge 2 commits intoSmithay:masterfrom
tobhe:eventfd

Conversation

@tobhe
Copy link
Copy Markdown
Contributor

@tobhe tobhe commented Feb 21, 2026

There are two remaining issues which I currently carry out of tree patches for to build on OpenBSD.

OpenBSD doesn't support eventfd

Since eventfd is entirely optional and smithay already has a supports_syncobj_eventfd runtime switch it is easy enough to conditionally disable.
Currently I use #[cfg(not(target_os = "openbsd"))] but maybe this would better be a feature?

libEGL loading is too strict

The libEGL backend hardcodes a libEGL.so.1 library name which doesn't work on OpenBSD where the current base libEGL is /usr/X11R6/lib/libEGL.so.2.0. Dropping the .1 suffix seems like the appropriate fix since that should generally find the right version automatically on both platforms. Alternatively we could just conditionally hardcode either version.

Conditionally disable all references to eventfd on OpenBSD
at compile time to make it work. This should not cause any
issues since eventfd is optional and support is detected
at runtime.
OpenBSD ships with /usr/X11R6/lib/libEGL.so.2.0 from Xenocara
which isn't found with the current hardcoded libEGL.so.1 path.

On Linux the current default libEGL is usually symlinked to an
unversioned name at /usr/lib/$ARCH_TRIPLET/libEGL.so ro similar.
On OpenBSD dlopen() is capable of finding a suitable versioned
file even if we don't explictly give it a version.
Removing the .1 suffix should satisfy both.
@Drakulix
Copy link
Copy Markdown
Member

Currently I use #[cfg(not(target_os = "openbsd"))] but maybe this would better be a feature?

linux-drm-syncobj-v1 (and linux-dmabuf-v1) are clearly intended as being OS-specific given their name, so I wouldn't even object to changing the condition to target_os = "linux". I assume openbsd has support for dmabuf's though, right?

@tobhe
Copy link
Copy Markdown
Contributor Author

tobhe commented Feb 23, 2026

linux-drm-syncobj-v1 (and linux-dmabuf-v1) are clearly intended as being OS-specific given their name, so I wouldn't even object to changing the condition to target_os = "linux"

That might actually make more sense. Things might be a little more difficult since the BSDs all use versions of the Linux DRM stack so there is a lot of overlap.

I assume openbsd has support for dmabuf's though, right?

I don't think we do. Not sure about the other BSD's though.

EDIT: OpenBSD does even have drm_syncobj, just eventfd isn't supported https://github.com/openbsd/src/blob/master/sys/dev/pci/drm/drm_syncobj.c#L1529 (not sure if that is strictly required for the protocol)

@Drakulix
Copy link
Copy Markdown
Member

linux-drm-syncobj-v1 (and linux-dmabuf-v1) are clearly intended as being OS-specific given their name, so I wouldn't even object to changing the condition to target_os = "linux"

That might actually make more sense. Things might be a little more difficult since the BSDs all use versions of the Linux DRM stack so there is a lot of overlap.

Seems like similar things might be true for drm_syncobj. So perhaps a feature is the best solution here?

@tobhe
Copy link
Copy Markdown
Contributor Author

tobhe commented Mar 1, 2026

I took another close look at rustix and they explicitly list supported OSs, so a feature seems kind of wrong since at the end of the day you would still not work on platforms rustix doesn't define, see https://github.com/bytecodealliance/rustix/blob/main/src/event/mod.rs#L5-L10

Maintaining the same list would work but also seems a bit wrong since it would mean they have to be kept in sync.
In C this is where I would use ifdef to propagate the conditional from the dependency. is there a rust equivalent?

@Drakulix
Copy link
Copy Markdown
Member

Drakulix commented Mar 3, 2026

Maintaining the same list would work but also seems a bit wrong since it would mean they have to be kept in sync. In C this is where I would use ifdef to propagate the conditional from the dependency. is there a rust equivalent?

No this sadly doesn't exist.

So either this needs to be an additive feature (something like backend_eventfd), which compositors need to explicitly enable depending on their target platforms ... or ... we simply copy the list from rustix and add a comment noting that this should be updated when updating rustix.

Comment thread src/backend/egl/ffi.rs

pub static LIB: LazyLock<Library> =
LazyLock::new(|| unsafe { Library::new("libEGL.so.1") }.expect("Failed to load LibEGL"));
LazyLock::new(|| unsafe { Library::new("libEGL.so") }.expect("Failed to load LibEGL"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Debian libEGL.so is part of the libegl-dev package, which end users do not normally have installed. You did probably have to make the filename conditional on OpenBSD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants