fix(cdi): include 32-bit libraries in discovery - #1968
Conversation
Signed-off-by: Eli Bosley <eli@bosley.dev>
Signed-off-by: Eli Bosley <eli@bosley.dev>
|
Thanks for the contribution. We will review this PR. |
|
Hi @elibosley, thanks for the contribution, the idea makes sense. One thing I'd suggest is to gate this behind an opt-in flag rather than making it default behavior.
We need to gate it because on musl-based containers (e.g. Alpine+gcompat), both the 32-bit and 64-bit library directories get appended into a single |
|
@elibosley just checking in — are you still planning to continue working on this PR? If not, we can close it for now and reopen it when you're ready to pick it back up. |
|
Opened #2035. |
|
@henry118 apologies, I am terrible at checking my GitHub notifications there are just too many 🥲 - sounds like you guys have it from here! Thank you for checking this out I appreciate it! |
|
Thanks @elibosley . I'll close this PR and track of work in #2035 instead. |
Summary
CDI generation omitted the host's 32-bit NVIDIA driver stack on multilib systems; this combines predefined-path and linker-cache discovery so generated specs include both native and compat32 libraries.
Why This Exists
ldcache.List()returns separate 32-bit and 64-bit library sets, but the CDI lookup path discarded the 32-bit set. The default library locator also stopped after finding libraries in a predefined native path, which prevented the linker cache from contributing libraries installed in a separate compat32 directory.The resulting CDI spec could expose the 64-bit NVIDIA stack while leaving a 32-bit Vulkan application such as a Steam or Proton title without the matching vendor libraries. In that state, the application can select software rendering even though compatible ELF32 NVIDIA libraries are installed on the host.
This is related to #563, which tracks broader graphics-library coverage.
Resolution
The default library locator now merges predefined-path and linker-cache results and deduplicates the combined list. Linker-cache discovery consumes both architecture lists, with native libraries first so existing version-inference precedence remains stable.
This keeps architecture discovery in the host linker cache rather than adding distribution-specific compat32 paths to CDI generation.
Reviewer Considerations
lookup.Mergecombinator is the preferred shape for combining locator results; it mirrors the existing exportedlookup.Firstbehavior while retaining successful matches when another locator fails.Behavior Changes
Implementation Summary
ldcache.List().Verification
make testpassed.go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest run --timeout 5m ./...passed with 0 issues.go vet ./pkg/lookuppassed.git diff --checkpassed./usr/lib64library mounts and 0/usr/liblibrary mounts;maingenerated 41/usr/lib64library mounts and 25/usr/liblibrary mounts;/usr/libentries were verified as ELF32 and includedlibcuda,libnvidia-ml, andlibGLX_nvidia.Risk
Low to moderate. The discovery set intentionally grows on multilib hosts, and the primary compatibility risk is a caller assuming only one architecture is returned. Native-first ordering, deduplication, package tests, the full upstream test suite, and real-host CDI generation cover that behavior.