cmake link_error ai_generated true

Runtime error: shared library not found after install

ID: cmake/install-rpath-error

Also available as: JSON · Markdown
80%Fix Rate
84%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3 active

Root Cause

Installed binary cant find shared libraries at runtime.

generic

Workarounds

  1. 90% success Set CMAKE_INSTALL_RPATH: set(CMAKE_INSTALL_RPATH "/../lib")
  2. 85% success Enable CMAKE_INSTALL_RPATH_USE_LINK_RPATH for build-tree rpaths

Dead Ends

Common approaches that don't work:

  1. Set LD_LIBRARY_PATH globally 75% fail

    Not portable, fragile

  2. Use -Wl,-rpath with absolute paths 72% fail

    Breaks on different install prefix