dynamic-linking

Diagnose and resolve Linux ELF shared library loading failures.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill dynamic-linking-awfixers-stuff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dynamic-linking
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/dynamic-linking
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill dynamic-linking-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Help developers and operators diagnose and fix Linux ELF shared library loading failures, versioning mismatches, and symbol resolution errors that cause binaries to fail at runtime.

Core Features & Use Cases

  • Library creation & soname versioning: guidance for building shared libraries with soname, semantic versioning rules for MAJOR.MINOR.PATCH, and symlink conventions for deployment.
  • RPATH vs RUNPATH and search order: instructions to embed and modify RPATH/RUNPATH, use $ORIGIN for relocatable layouts, and tools to inspect or change runtime search paths.
  • Runtime linking & debugging: techniques for dlopen/dlsym plugin patterns, LD_PRELOAD interposition for testing or instrumentation, LD_DEBUG/ldd for tracing resolution, and symbol visibility control with version scripts.
  • Real-world scenarios: resolving "cannot open shared object file" errors, fixing undefined symbol lookups due to ABI mismatches, and preparing libraries for safe upgrades and packaging.

Quick Start

Diagnose why myapp fails to load libfoo.so and provide step-by-step fixes to set RUNPATH, verify soname, and validate symbol versions.

Frequently Asked Questions about dynamic-linking

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix Linux shared library loading failures like "cannot open shared object file"?

Resolve Linux shared library loading failures by using readelf and ldd to inspect ELF binaries, then correcting RPATH or RUNPATH configurations to ensure the dynamic linker locates required shared objects at runtime.

What is the difference between RPATH and RUNPATH for ELF binaries?

RPATH and RUNPATH are ELF dynamic linking attributes dictating library search order; RUNPATH allows LD_LIBRARY_PATH overrides while RPATH takes precedence, affecting how the dynamic linker resolves shared object dependencies.

How do I use LD_PRELOAD to interpose shared library symbols for testing?

LD_PRELOAD interposes shared library symbols by forcing the dynamic linker to load specified libraries first, overriding functions for testing or instrumentation without modifying the original ELF binary.

How do I configure dlopen and dlsym for plugin loading in Linux?

Configure dlopen and dlsym plugin loading by programmatically opening shared libraries at runtime, resolving exported symbols, and controlling symbol visibility using version scripts to ensure proper ABI compatibility.

Why does my application fail with undefined symbol lookups due to ABI mismatches?

Undefined symbol lookups occur during dynamic linking when shared library ABI versions mismatch; use LD_DEBUG to trace resolution, verify soname versioning, and validate symbol visibility to fix the errors.

What's the best way to use $ORIGIN for relocatable shared library layouts?

Use $ORIGIN in RPATH or RUNPATH linker flags to create relocatable ELF binary layouts, allowing the dynamic linker to resolve shared libraries relative to the executable's directory location at runtime.