Makefile: name the missing library instead of stopping at cannot find -lnvfm - #20
Open
100milliongold wants to merge 1 commit into
Open
Conversation
When libnvfm is unusable the build stopped at the linker with "cannot find -lnvfm", which reads like a mistake in the build rather than a gap in the development package. Some builds of nvidia-fabricmanager-dev install the linker symlink libnvfm.so without the libnvfm.so.1 it points at. The symlink alone does not satisfy -lnvfm, and because ls and dpkg -L both show the file the package looks correctly installed. Check for the library before linking and report which case it is: absent everywhere, or present as a symlink to a library that is not installed. NVFM_LIB_DIRS lists the directories searched and can be overridden to point at a development package unpacked elsewhere. The first match decides, matching how ld resolves -l. Document the same trap and the rpath-based workaround in the README. Refs NVIDIA#19 Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
libnvfmis not usable, the build stops at the linker:That message covers three different situations and distinguishes none of them:
libnvfm.soas a symlink to alibnvfm.so.1that was never packaged.The third is what people hit on Ubuntu 24.04 today. Every
nvidia-fabricmanager-devpackage built fromSource: nvidia-fabricmanagerin the CUDAubuntu2404repository — the newest, 610.57.04, included — installs the symlink without the library behind it.lsshows alibnvfm.soin the expected place anddpkg -Llists it, so the package looks correctly installed and the linker error looks like a mistake in the build. Details and the full version table are in #19.Change
Two files, 60 lines added, nothing removed.
Makefile— before linking, look forlibnvfm.soacross the usual library directories and stop with a message that names what is actually wrong. When the library is present the recipe behaves exactly as it did before.The directory list is a variable, so an installation outside the system paths can be pointed at:
README.md— a note in the build prerequisites covering the packaging problem, thedpkg -ccommand that identifies an affected package without installing it, and the workaround.Output
Nothing installed:
Symlink with nothing behind it:
Implementation notes
test -efollows symlinks andtest -Ldoes not. Together they separate "nothing installed" from "symlink with no target", which is the distinction this packaging bug turns on.libnvfm.soentry and reports on that one, rather than skipping a broken entry to find a good one further along.ldtakes the first match in its own search order and fails there, so continuing past a broken symlink would report success on a build that then fails.LDFLAGSor add-Lpaths. It reports and stops; it does not try to repair the link line. It also does not readLDIR, which names a single fixed directory and is not the set of pathsldactually searches.nv_fm_agent.halready produces a compile error that names the file;cannot find -lnvfmis the one that does not say why.make cleanis unaffected and an up-to-datefmpmis still not relinked.Verification
Tested with GNU Make 3.81 and GNU Make 4.4.1, against three fixture directories: one holding
libnvfm.so.1plus thelibnvfm.sosymlink, one holding only the dangling symlink, and one empty.Also confirmed:
libnvfm.soas a real file, not a symlinkg++runsNVFM_LIB_DIRS="t/dangling t/present"ldNVFM_LIB_DIRS="t/absent t/present"g++runsNVFM_LIB_DIRS, no overridemake cleanfmpmnewer thanfmpm.o'fmpm' is up to date, no relinkThe expanded recipe was extracted with
make -nand passessh -n,bash -nandzsh -n, and running it undershreproduces all three verdicts with exit codes 1, 1 and 0.Refs #19
🤖 Generated with Claude Code