Commit 38ce338
committed
fix(compat.glx-runtime):
On Fedora 44 this package produced
libGLX.so.0 -> /usr/lib/libGLX.so.0 # 32-bit
libOpenGL.so.0 -> /usr/lib64/libOpenGL.so.0
and the application died with `libGLX.so.0: wrong ELF class: ELFCLASS32`,
surfacing as a silent exit code 255 with no output at all.
THE OBVIOUS DIAGNOSIS IS NOT THE BUG. The issue reads this as "generated
assuming the Debian layout", but `/usr/lib64` is already ahead of `/usr/lib` in
`candidate_dirs()`. Two other things were wrong:
1. **`ln -sf` overwrites.** The loop reached /usr/lib64 first and linked the
correct file, then reached /usr/lib and replaced it. Last-wins, not
first-wins. `libOpenGL.so.0` survived as 64-bit only because that host's
32-bit glvnd does not ship it -- which is why exactly one link in the bug
report was right, and that is evidence rather than coincidence.
2. **No ABI check anywhere**, including in `required`, which asserted that
libGLX.so.0 and libGL.so.1 EXIST. Both existed. Both were 32-bit. So the
package reported success.
There is no layout to assume, which is why a better ordering is not the fix: the
FHS biarch clause makes /usr/lib 32-bit (Fedora/RHEL/SUSE), Debian explicitly
declined that clause and uses /usr/lib/<triplet> so its /usr/lib is 64-bit, and
Arch is a third answer again. An ABI check makes the order stop mattering.
So: enumerate and decide per file (first-wins, keyed by soname), read
e_ident[EI_CLASS] out of the file itself -- five bytes, no external tool, because
`file`/`readelf` may not be installed when a hook runs -- and make `required`
assert 64-bit rather than merely present. Both failure paths now name the cause
and what to install.
Verified against a forged biarch host (32-bit libGLX.so.0 in /usr/lib, the real
one in /usr/lib64): both required links resolve to /usr/lib64 and both are
ELF64. The same fixture under the old loop lands on /usr/lib.
The same three rules -- ask the loader, check the ABI, first hit wins -- are now
one shared module in the xlings index (libs/hostlib.lua), where four call sites
had four answers and three were wrong.
Refs: mcpp-community/mcpp#352
Design: openxlings/xlings .agents/docs/2026-08-07-graphics-experience-industry-survey-and-plan.md §8.1, §9.2ln -sf was last-wins, and nothing checked the ABI (mcpp#352)1 parent 52da54a commit 38ce338
1 file changed
Lines changed: 72 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
107 | 144 | | |
108 | 145 | | |
| 146 | + | |
109 | 147 | | |
110 | 148 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
117 | 167 | | |
118 | 168 | | |
119 | 169 | | |
120 | 170 | | |
121 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
122 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
123 | 186 | | |
124 | 187 | | |
125 | 188 | | |
| 189 | + | |
| 190 | + | |
126 | 191 | | |
127 | 192 | | |
128 | 193 | | |
| |||
0 commit comments