x11-rs
x11-rs copied to clipboard
Issue on Debian 7 (wheezy).
I ran into this when trying to run my own build of alacritty
. I verified that my /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0
does not export XRRChangeProviderProperty
.
thread 'main' panicked at 'Failed to initialize any backend!
Wayland status: NoWaylandLib
X11 status: LibraryOpenError(
OpenError {
kind: Symbol,
detail: "XRRChangeProviderProperty - /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0: undefined symbol: XRRChangeProviderProperty"
}
)
', /opt/rust/.cargo.Linux/registry/src/github.com-1ecc6299db9ec823/winit-0.15.0/src/platform/linux/mod.rs:418:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::panicking::default_hook::{{closure}}
at libstd/sys_common/backtrace.rs:71
2: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:227
at libstd/panicking.rs:463
3: std::panicking::begin_panic
at /checkout/src/libstd/panicking.rs:397
4: alacritty::display::Display::new
at /opt/rust/.cargo.Linux/registry/src/github.com-1ecc6299db9ec823/winit-0.15.0/src/platform/linux/mod.rs:418
5: alacritty::main
at src/main.rs:104
at src/main.rs:62
6: std::rt::lang_start::{{closure}}
at /checkout/src/libstd/rt.rs:74
7: main
8: __libc_start_main
9: <unknown>
Can this symbol being missing be marked as non-fatal somehow?
Something similar to this has occurred before. The solution we used was to provide an alternate struct that only included symbols available in an older version. If I ever get around to getting the v3
branch up and running, I'll stop encouraging x11-dl
in favor of generated bindings, similar to how the gl_generator
crate is used.
In the meantime, can you post the output you get from running:
readelf -Ws /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0
I'll add a struct, probably called XrandrWheezy
or something, that only includes the functions listed from readelf
output. Thanks!
Thanks a lot! Here you go:
Symbol table '.dynsym' contains 87 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000001870 0 SECTION LOCAL DEFAULT 10
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND free@GLIBC_2.2.5 (2)
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XData32
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XReply
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND XextFindDisplay
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strlen@GLIBC_2.2.5 (2)
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND XFree
9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XSend
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND XextRemoveDisplay
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XDeqAsyncHandler
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcpy@GLIBC_2.2.5 (2)
13: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND XMissingExtension
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND XRenderSetSubpixelOrder
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XGetRequest
17: 0000000000000000 0 FUNC GLOBAL DEFAULT UND malloc@GLIBC_2.2.5 (2)
18: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XRead32
19: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XGetAsyncReply
20: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XRead
21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XSetLastRequestRead
22: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memmove@GLIBC_2.2.5 (2)
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XReadPad
24: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _XEatData
26: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
27: 0000000000000000 0 FUNC GLOBAL DEFAULT UND XextAddDisplay
28: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2)
29: 00000000000045a0 217 FUNC GLOBAL DEFAULT 12 XRRDestroyMode
30: 0000000000002b40 12 FUNC GLOBAL DEFAULT 12 XRRConfigTimes
31: 0000000000002af0 73 FUNC GLOBAL DEFAULT 12 XRRConfigRates
32: 0000000000004220 316 FUNC GLOBAL DEFAULT 12 XRRSetPanning
33: 0000000000002ed0 486 FUNC GLOBAL DEFAULT 12 XRRSetScreenConfigAndRate
34: 0000000000004210 5 FUNC GLOBAL DEFAULT 12 XRRFreePanning
35: 00000000000061a0 5 FUNC GLOBAL DEFAULT 12 XRRFreeScreenResources
36: 0000000000002b70 172 FUNC GLOBAL DEFAULT 12 XRRRotations
37: 0000000000006444 0 FUNC GLOBAL DEFAULT 13 _fini
38: 0000000000004880 5 FUNC GLOBAL DEFAULT 12 XRRFreeModeInfo
39: 0000000000005170 403 FUNC GLOBAL DEFAULT 12 XRRConfigureOutputProperty
40: 0000000000004360 135 FUNC GLOBAL DEFAULT 12 XRRAllocModeInfo
41: 0000000000004ce0 294 FUNC GLOBAL DEFAULT 12 XRRGetOutputPrimary
42: 00000000000057c0 860 FUNC GLOBAL DEFAULT 12 XRRGetOutputProperty
43: 00000000000021f0 404 FUNC GLOBAL DEFAULT 12 XRRQueryVersion
44: 0000000000006180 10 FUNC GLOBAL DEFAULT 12 XRRGetScreenResources
45: 0000000000004fd0 414 FUNC GLOBAL DEFAULT 12 XRRQueryOutputProperty
46: 0000000000003320 5 FUNC GLOBAL DEFAULT 12 XRRFreeCrtcInfo
47: 0000000000004060 422 FUNC GLOBAL DEFAULT 12 XRRGetPanning
48: 00000000000056c0 255 FUNC GLOBAL DEFAULT 12 XRRDeleteOutputProperty
49: 0000000000002c20 166 FUNC GLOBAL DEFAULT 12 XRRSizes
50: 0000000000006300 321 FUNC GLOBAL DEFAULT 12 XRRSetScreenSize
51: 0000000000003760 351 FUNC GLOBAL DEFAULT 12 XRRSetCrtcGamma
52: 0000000000004890 804 FUNC GLOBAL DEFAULT 12 XRRGetOutputInfo
53: 0000000000002ec0 5 FUNC GLOBAL DEFAULT 12 XRRFreeScreenConfigInfo
54: 00000000000038c0 5 FUNC GLOBAL DEFAULT 12 XRRFreeGamma
55: 0000000000002e30 137 FUNC GLOBAL DEFAULT 12 XRRGetScreenInfo
56: 00000000000043f0 431 FUNC GLOBAL DEFAULT 12 XRRCreateMode
57: 0000000000003330 355 FUNC GLOBAL DEFAULT 12 XRRSetCrtcConfig
58: 00000000000061b0 323 FUNC GLOBAL DEFAULT 12 XRRGetScreenSizeRange
59: 00000000000038d0 497 FUNC GLOBAL DEFAULT 12 XRRSetCrtcTransform
60: 0000000000006190 7 FUNC GLOBAL DEFAULT 12 XRRGetScreenResourcesCurrent
61: 0000000000004780 255 FUNC GLOBAL DEFAULT 12 XRRDeleteOutputMode
62: 0000000000002ad0 12 FUNC GLOBAL DEFAULT 12 XRRConfigRotations
63: 0000000000005310 940 FUNC GLOBAL DEFAULT 12 XRRChangeOutputProperty
64: 0000000000002d90 158 FUNC GLOBAL DEFAULT 12 XRRTimes
65: 0000000000004e10 438 FUNC GLOBAL DEFAULT 12 XRRListOutputProperties
66: 0000000000002cd0 190 FUNC GLOBAL DEFAULT 12 XRRRates
67: 0000000000002510 430 FUNC GLOBAL DEFAULT 12 XRRUpdateConfiguration
68: 00000000002074b8 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
69: 00000000002074e8 0 NOTYPE GLOBAL DEFAULT ABS _end
70: 0000000000002400 263 FUNC GLOBAL DEFAULT 12 XRRSelectInput
71: 0000000000002110 66 FUNC GLOBAL DEFAULT 12 XRRRootToScreen
72: 0000000000004bc0 5 FUNC GLOBAL DEFAULT 12 XRRFreeOutputInfo
73: 0000000000002ae0 10 FUNC GLOBAL DEFAULT 12 XRRConfigSizes
74: 0000000000002b60 5 FUNC GLOBAL DEFAULT 12 XRRConfigCurrentRate
75: 00000000000030c0 25 FUNC GLOBAL DEFAULT 12 XRRSetScreenConfig
76: 0000000000002160 97 FUNC GLOBAL DEFAULT 12 XRRQueryExtension
77: 0000000000004bd0 263 FUNC GLOBAL DEFAULT 12 XRRSetOutputPrimary
78: 00000000000035d0 399 FUNC GLOBAL DEFAULT 12 XRRGetCrtcGamma
79: 00000000002074b8 0 NOTYPE GLOBAL DEFAULT ABS _edata
80: 00000000000030e0 569 FUNC GLOBAL DEFAULT 12 XRRGetCrtcInfo
81: 00000000000034a0 210 FUNC GLOBAL DEFAULT 12 XRRGetCrtcGammaSize
82: 0000000000003ad0 1424 FUNC GLOBAL DEFAULT 12 XRRGetCrtcTransform
83: 0000000000003580 79 FUNC GLOBAL DEFAULT 12 XRRAllocGamma
84: 0000000000002b50 11 FUNC GLOBAL DEFAULT 12 XRRConfigCurrentConfiguration
85: 0000000000004680 255 FUNC GLOBAL DEFAULT 12 XRRAddOutputMode
86: 0000000000001870 0 FUNC GLOBAL DEFAULT 10 _init
I wondered what the difference was between x11-dl
and x11
. I'm very new to this stuff!
x11
is much cleaner and nicer than x11-dl
, but x11-dl
is used in situations where it's uncertain whether the system running a program even has libX11.so.6
. I don't like the x11-dl
situation because it's full of hacks and workarounds, and my previous v3 plans are only slightly better, but it's the best that we have unless I or someone else writes a higher level binding like vberger
did with the wayland bindings.
Scratch that. My memory failed me. I was thinking that the last time we added a compatibility struct, it was for Xlib
, but looking back at the code, it was Xrandr
. This struct is x11_dl::xrandr::Xrandr_2_2_0
. See if using this instead of x11_dl::xrandr::Xrandr
fixes the problem. Are you using x11-dl
directly, or is it a dependency of something else you're using?
Is there a reason you're not having functions available only in newer versions be an Option? You could even assign them only if the server returns the appropriate protocol version.
When I first wrote x11-dl
I rushed to get it out so it could be used by glutin
and a few other projects. The current behavior expects all function pointers to be non-zero. Checking the protocol version to determine which functions to support is possible, but it would require a major version bump in addition to knowing the minimum protocol versions for every function, and there a lots of functions. This isn't a problem, but it would take some work. As of last year, I don't have the time to do significant work on any programming projects (because school) and have mostly just been checking and merging pull requests. Lately I've been leaning toward safe, high level bindings being better for Rust than directly exposing the C API as both x11
and x11-dl
crates currently do. If time permits some day, I may do some work on this, but for now I'm mostly just sitting on x11-rs
until somebody else volunteers to take it over.
TLDR: That's a great idea that hadn't occurred to me, but I won't be able to implement it myself in the near future.