docs: troubleshoot CUDA device-LTO elfLink failure on apt nvidia-cuda-toolkit#876
docs: troubleshoot CUDA device-LTO elfLink failure on apt nvidia-cuda-toolkit#876IvanaGyro wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a "Build troubleshooting" section to the advanced installation documentation, explaining how to resolve a CUDA device link error (elfLink linker library load error) caused by a layout issue in the Debian/Ubuntu nvidia-cuda-toolkit package. The feedback suggests formatting the shell code blocks with a space after the $ prompt for consistency, and using the unversioned libnvvm.so as the symlink source to make the workaround more robust and future-proof.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #876 +/- ##
=======================================
Coverage 29.49% 29.49%
=======================================
Files 241 241
Lines 35512 35512
Branches 14777 14777
=======================================
Hits 10475 10475
Misses 17784 17784
Partials 7253 7253
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
…lkit Add a "Build troubleshooting" section to the advanced install guide covering "nvlink fatal : elfLink linker library load error" during a CUDA-enabled build. On non-Apple builds Cytnx enables CMAKE_INTERPROCEDURAL_OPTIMIZATION, which together with CUDA separable compilation turns on CUDA device LTO (nvcc -dlto). The device link step loads NVVM. The Debian/Ubuntu nvidia-cuda-toolkit apt package installs libnvvm.so under /usr/lib/x86_64-linux-gnu/ but not under the toolkit's lib64 directory, where nvcc points nvlink via -nvvmpath=/usr/lib/nvidia-cuda-toolkit; nvlink then fails to open /usr/lib/nvidia-cuda-toolkit/lib64/libnvvm.so. The empty glibc 2.34+ stub archives (libpthread.a / librt.a / libdl.a) are unrelated and are tolerated by nvlink, so they are explicitly called out as not being the cause. Document the recommended fix (install a complete CUDA toolkit from conda or NVIDIA so libnvvm.so sits in nvvm/lib64) and a symlink workaround for the distribution package. Co-authored-by: Claude <noreply@anthropic.com>
58c6c3b to
f0dc9c1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0dc9c1986
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .. code-block:: shell | ||
|
|
||
| $sudo mkdir -p /usr/lib/nvidia-cuda-toolkit/lib64 | ||
| $sudo ln -s /usr/lib/x86_64-linux-gnu/libnvvm.so /usr/lib/nvidia-cuda-toolkit/lib64/libnvvm.so |
There was a problem hiding this comment.
Link to the versioned libnvvm soname
On stock Debian/Ubuntu apt installs, libnvvm4 provides /usr/lib/x86_64-linux-gnu/libnvvm.so.4 and .4.0.0, not an unversioned /usr/lib/x86_64-linux-gnu/libnvvm.so (Ubuntu jammy, Debian sid). In that environment this ln -s command creates a dangling /usr/lib/nvidia-cuda-toolkit/lib64/libnvvm.so, so the documented workaround still leaves nvlink unable to load NVVM. Please point the symlink at the actual versioned file found by find or make the command use that discovered path.
Useful? React with 👍 / 👎.
Review: PR #876 — "docs: troubleshoot CUDA device-LTO elfLink failure on apt nvidia-cuda-toolkit"OverviewDocs-only addition of a "Build troubleshooting" section covering the AccuracyThe technical content is correct and well-researched:
Two minor issues1. Missing space after Both shell examples are formatted as $ conda install -c nvidia cuda $ sudo mkdir -p /usr/lib/nvidia-cuda-toolkit/lib64
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libnvvm.so /usr/lib/nvidia-cuda-toolkit/lib64/libnvvm.so2. Missing third option: disable device LTO Users who need a quick escape hatch without changing their toolkit installation could simply disable LTO at configure time. Worth adding a brief note after the workaround: **Alternative: disable device LTO.** If neither option above is practical,
configure with ``-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF`` to skip device LTO
entirely. The build will complete but without link-time optimizations.RST structureSection hierarchy ( Summary
Posted by Claude Code on behalf of @pcchen |
Summary
Adds a Build troubleshooting section to
docs/source/adv_install.rstdocumenting the CUDA device-LTO failure:This surfaced while preparing a CUDA build on Ubuntu and was initially misattributed to glibc 2.34+ empty stub archives. The doc records the real cause and the fix so others don't chase the same dead end.
What the section explains
-DUSE_CUDA=ONbuild configures fine but the device-link step aborts with theelfLinkerror. It only appears because Cytnx enablesCMAKE_INTERPROCEDURAL_OPTIMIZATIONon non-Apple builds, which (with CUDA separable compilation) turns on CUDA device LTO (nvcc -dlto).nvidia-cuda-toolkitapt package shipslibnvvm.soin/usr/lib/x86_64-linux-gnu/but not under the toolkit'slib64/, wherenvccpoints nvlink via-nvvmpath=/usr/lib/nvidia-cuda-toolkit. nvlink then can't open/usr/lib/nvidia-cuda-toolkit/lib64/libnvvm.so. The empty glibc stub archives are explicitly called out as not the cause (nvlink tolerates them).conda install -c nvidia cuda) or NVIDIA's installer, which keeplibnvvm.soundernvvm/lib64.libnvvm.sointo the path nvlink searches.Evidence
All verified on glibc 2.39: device LTO links cleanly on conda CUDA 12.0–12.9 (even with empty stubs on the line) and on a standard install; it fails only on the apt-packaged 12.0, with or without stubs.
straceconfirmed the single failingopenatis/usr/lib/nvidia-cuda-toolkit/lib64/libnvvm.so, and adding that one symlink makes the link succeed.Notes
master.