Skip to content

fix(nvjitlink): resolve versioned toolkit symbols - #1103

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
almightychang:fix-nvjitlink-versioned-symbols
Aug 23, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
almightychang:fix-nvjitlink-versioned-symbols

Conversation

@almightychang

Copy link
Copy Markdown
Contributor

nvjitlink-sys assumed every nvJitLink library exported unsuffixed public entry points. Debian's CUDA 12 package does not:

$ nm -D --defined-only /usr/lib/x86_64-linux-gnu/libnvJitLink.so.12 \
    | grep -E 'nvJitLink(Create|Destroy|AddData|Complete|GetLinkedCubin)'
0000000000226bd0 T __nvJitLinkAddData_12_0@@libnvJitLink.so.12
0000000000226f50 T __nvJitLinkComplete_12_0@@libnvJitLink.so.12
0000000000226010 T __nvJitLinkCreate_12_0@@libnvJitLink.so.12
0000000000226ab0 T __nvJitLinkDestroy_12_0@@libnvJitLink.so.12
0000000000227480 T __nvJitLinkGetLinkedCubinSize_12_0@@libnvJitLink.so.12
00000000002274e0 T __nvJitLinkGetLinkedCubin_12_0@@libnvJitLink.so.12

The toolkit header maps each public inline API to those versioned symbols. The crate-level documentation instead said the library also exported unsuffixed names with default ELF symbol versioning, and LibNvJitLink::load_inner implemented that claim with unsuffixed-only dlsym calls. Loading therefore stopped at nvJitLinkCreate on this installation.

Required and optional entry points now resolve the unsuffixed name first, then the CUDA 13.0 and 12.0 mangled names. This preserves existing toolkits and fixes Debian CUDA 12; tests pin the order and resolve a synthetic library that exports only __nvJitLinkCreate_12_0. The crate documentation now describes both export shapes.

Verification

  • cargo test -p nvjitlink-sys --all-targets — 12 passed, 3 live-toolkit tests ignored.
  • CUDA_TOOLKIT_PATH=/usr cargo test -p nvjitlink-sys -- --ignored — all 3 live-toolkit tests passed against Debian CUDA 12.
  • cargo clippy --workspace --all-targets -- -D warnings
  • RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --workspace
  • RUSTDOCFLAGS='-D warnings' cargo test --doc --workspace --exclude cuda-bindings
  • cargo fmt --all -- --check
  • cargo oxide build vecadd --materialize-cubin --arch sm_86 completed with the Debian CUDA 12 libNVVM and nvJitLink libraries selected by exact paths.
  • SPDX, dependency-policy, crate-inventory, and test-matrix guards pass.

@nihalpasham nihalpasham added bug Something isn't working host-apis Host-side runtime APIs (cuda-host, cuda-core, cuda-async) build-related Build scripts, toolchain discovery, or compilation setup labels Aug 23, 2026
@nihalpasham
nihalpasham force-pushed the fix-nvjitlink-versioned-symbols branch from 7dd1f5e to b44660b Compare August 23, 2026 04:41
@nihalpasham

nihalpasham commented Aug 23, 2026 •

Copy link
Copy Markdown
Collaborator
  • Reproduced the Debian CUDA 12 failure: its library exports only versioned symbols. The resolver now tries the public name, CUDA 13 name, then CUDA 12 name; the synthetic loader and both live toolkits pass all three tests.
  • I rebased the unchanged contributor patch onto current main; authorship and DCO are preserved.
  • The 12 unit tests, fmt, strict clippy, and rustdoc pass. Hosted CI is queued and waiting for explicit fork-run approval.
  • No issue is linked.

@nihalpasham
nihalpasham merged commit e5780e6 into NVIDIA:main Aug 23, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working build-related Build scripts, toolchain discovery, or compilation setup host-apis Host-side runtime APIs (cuda-host, cuda-core, cuda-async)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants