-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fix dl-libxcb feature on OpenBSD and NetBSD #788
Conversation
Codecov ReportBase: 13.70% // Head: 13.70% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #788 +/- ##
=======================================
Coverage 13.70% 13.70%
=======================================
Files 142 142
Lines 120070 120070
=======================================
Hits 16454 16454
Misses 103616 103616
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
On NetBSD this is now just showing |
Urgh. I kind of assumed this to be in the default search path. :-( I guess this means we need an absolute path. diff --git a/x11rb/src/xcb_ffi/raw_ffi/ffi.rs b/x11rb/src/xcb_ffi/raw_ffi/ffi.rs
index 75da58c..ca2726e 100644
--- a/x11rb/src/xcb_ffi/raw_ffi/ffi.rs
+++ b/x11rb/src/xcb_ffi/raw_ffi/ffi.rs
@@ -36,9 +36,10 @@ pub(crate) mod libxcb_library {
compile_error!("dl-libxcb feature is not supported on non-unix");
#[cfg(all(unix, not(any(target_os = "openbsd", target_os = "netbsd"))))]
const LIB_NAME: &str = "libxcb.so.1";
- // libtool turns -version-info differently into SONAMES on Open and NetBSD
+ // libtool turns -version-info differently into SONAMES on Open and NetBSD.
+ // Also, the library is apparently not in the default search path, hence use a full path.
#[cfg(any(target_os = "openbsd", target_os = "netbsd"))]
- const LIB_NAME: &str = "libxcb.so.2";
+ const LIB_NAME: &str = "/usr/X11R7/lib/libxcb.so.2";
let library = libloading::Library::new(LIB_NAME)
.map_err(|e| LibxcbLoadError::OpenLibError(LIB_NAME.into(), e.to_string()))?; (The above was amended into this PR) |
Turns out that libtool uses a different logic for turning its "-version-info" into a file name on OpenBSD and NetBSD than on Linux, Darwin, and FreeBSD. On the affected BSDs, this just takes "current", which is the first argument to "-version-info". Everywhere else, the logic is "current - age". Since libxcb uses "-version-info 2:0:1", this means that we end up with libxcb.so.2 on OpenBSD and NetBSD instead of the libxcb.so.1 that the code expects. Thus, we failed to load libxcb. Fix this by correcting the library name on OpenBSD and NetBSD. Additionally, the folder is apparently not in the default search path, so we need an absolute path. No idea whether this is also needed on OpenBSD. I will wait for someone to complain/test. Fixes: #785 Signed-off-by: Uli Schlachter <psychon@znc.in>
@ids1024 Could you run |
|
Then I believe we can assume that the |
Does that mean I get an approve? :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As expected, examples now run on NetBSD with dl-libxcb
. I think OpenBSD should be the same but haven't tested it.
(Apparently x86_64-unknown-illumos
is also a Rust Tier 2 target with host tools? I wonder where the library is there...)
Turns out that libtool uses a different logic for turning its "-version-info" into a file name on OpenBSD and NetBSD than on Linux, Darwin, and FreeBSD. On the affected BSDs, this just takes "current", which is the first argument to "-version-info". Everywhere else, the logic is "current - age".
Since libxcb uses "-version-info 2:0:1", this means that we end up with libxcb.so.2 on OpenBSD and NetBSD instead of the libxcb.so.1 that the code expects. Thus, we failed to load libxcb.
Fix this by correcting the library name on OpenBSD and NetBSD.
Fixes: #785
Signed-off-by: Uli Schlachter psychon@znc.in
@ids1024 Since you say you have a NetBSD VM, could you give this PR a try?