OpenBSD: Fix remaining build issues#1942
Conversation
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.
|
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 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) |
Seems like similar things might be true for drm_syncobj. So perhaps a feature is the best solution here? |
|
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. |
No this sadly doesn't exist. So either this needs to be an additive feature (something like |
|
|
||
| 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")); |
There was a problem hiding this comment.
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.
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.