Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Servers, nginx and Docker

A program crashes looking for libdl.so on newer Ubuntu

Your error

DllNotFoundException: libdl.so assembly:<unknown assembly> type:<unknown type> member:(null)1 more line it can show

Fix it fast

Most common cause, 1 of 3

A prebuilt app or plugin asks for the plain name libdl.so

Leave system folders alone: put a libdl.so link to libdl.so.2 in a folder of your own and launch the program with that folder on LD_LIBRARY_PATH.

Fix
mkdir -p ~/.local/lib/libdl-shim
ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 ~/.local/lib/libdl-shim/libdl.so
LD_LIBRARY_PATH=~/.local/lib/libdl-shim ./your-app
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

Ubuntu 22.04 and 24.04 use glibc 2.34 or later, where libdl was folded into libc. The packages keep libdl.so.2 and an empty libdl.a, but no plain libdl.so, so code that opens libdl.so by that name fails. Change the name to libdl.so.2 in code you own, or start a prebuilt app with a libdl.so link on LD_LIBRARY_PATH.

  • Applies to Ubuntu 22.04 LTS, Ubuntu 24.04 LTS, glibc 2.34 and later
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Run the program once with the loader's search log switched on and keep only the libdl lines. A search for libdl.so that ends without a match confirms the plain name is the problem; who owns the code that asked decides between cause 1 and cause 2. A failure while building, not running, is cause 3.

Run this first
LD_DEBUG=libs ./your-app 2>&1 | grep -n "libdl"

Then find the line you see in this list and open its fix:

  1. 1A prebuilt app or plugin asks for the plain name libdl.soThe loader log searches for libdl.so and finds nothing, and the request comes from code you cannot rebuild, such as a Unity or Mono plugin or a vendor binary
  2. 2Your own code opens libdl by the unversioned nameA search of your source finds the string libdl.so with no version number after it
  3. 3A build file links libdl.so by its full pathThe failure happens at link time and the message names /usr/lib/x86_64-linux-gnu/libdl.so

What does the error look like?

  • DllNotFoundException: libdl.so assembly:<unknown assembly> type:<unknown type> member:(null)
  • Assimp.Unmanaged.UnmanagedLibrary+UnmanagedLinuxLibraryImplementation.NativeLoadLibrary (System.String path)

Cause 1 of 3

A prebuilt app or plugin asks for the plain name libdl.so

You seeThe loader log searches for libdl.so and finds nothing, and the request comes from code you cannot rebuild, such as a Unity or Mono plugin or a vendor binary

Check

Some older plugins open libdl through the unversioned file name. On Ubuntu 22.04 and 24.04 no package installs that file: libc6 carries libdl.so.2 and libc6-dev carries only libdl.a. The AssimpNet plugin inside Unity's URDF Importer is one public case, stopping with DllNotFoundException: libdl.so.

Check
ls -l /usr/lib/x86_64-linux-gnu/libdl*

Fix

Leave system folders alone: put a libdl.so link to libdl.so.2 in a folder of your own and launch the program with that folder on LD_LIBRARY_PATH. The variable has to be set when the program starts. Users in the Unity issue placed the same link in a system library folder instead, which also works but affects every program on the machine.

Fix
mkdir -p ~/.local/lib/libdl-shim
ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 ~/.local/lib/libdl-shim/libdl.so
LD_LIBRARY_PATH=~/.local/lib/libdl-shim ./your-app

Verify

The loader log now shows libdl.so resolved inside the shim folder, and the program gets past the point where it crashed.

Verify
LD_DEBUG=libs LD_LIBRARY_PATH=~/.local/lib/libdl-shim ./your-app 2>&1 | grep -n "libdl"

Confirmed by github.com

Did this fix it?

Cause 2 of 3

Your own code opens libdl by the unversioned name

You seeA search of your source finds the string libdl.so with no version number after it

Check

glibc 2.34 moved dlopen, dlsym and the rest of libdl into libc, and the old libdl.so.2 shared object stayed only for programs linked against earlier releases. A run-time lookup of the plain name libdl.so only succeeds when some file by that name exists, and Ubuntu 22.04 and 24.04 install none.

Check
grep -rnE "libdl\.so[\"']" --exclude-dir=node_modules --exclude-dir=.git .

Fix

Call the dl functions directly, because libc exports them now. If a handle to libdl itself is still needed, open the versioned file libdl.so.2, which the libc6 package installs.

Fix
/* C: dlopen comes from libc on glibc 2.34+, no libdl handle required */
void *lib = dlopen("libfoo.so.1", RTLD_NOW);

/* only if the code really needs a handle to libdl */
void *dl = dlopen("libdl.so.2", RTLD_NOW);

# Python ctypes
import ctypes
dl = ctypes.CDLL("libdl.so.2")

Verify

The program starts on Ubuntu 22.04 and 24.04 without a shim folder, and the loader log shows libdl.so.2 or no libdl lookup at all.

Verify
LD_DEBUG=libs ./your-app 2>&1 | grep -n "libdl"

Confirmed by lists.gnu.org

Did this fix it?

Cause 3 of 3

A build file links libdl.so by its full path

You seeThe failure happens at link time and the message names /usr/lib/x86_64-linux-gnu/libdl.so

Check

For backward compatibility glibc keeps an empty static libdl.a so that the -ldl flag still links, and Ubuntu's libc6-dev ships exactly that file. A Makefile, linker flag or cached CMake value that spells out the path to libdl.so names a file no Ubuntu package installs.

Check
grep -rn "libdl\.so" --include=Makefile --include=CMakeLists.txt --include=CMakeCache.txt --include='*.cmake' .

Fix

Swap the path for -ldl, or drop it, since libc already provides the functions. Delete a stale CMakeCache.txt so the old path is not reused.

Fix
# before
LDLIBS += /usr/lib/x86_64-linux-gnu/libdl.so
# after
LDLIBS += -ldl

Verify

The link step completes and the binary runs.

Verify
make clean && make

Confirmed by lists.gnu.org

Did this fix it?

How do I stop it coming back?

  • Search code and build files for the bare string libdl.so before moving a project onto Ubuntu 22.04 or later.
  • Ask plugin vendors for builds that load libdl.so.2, and record any shim folder in the project README with the reason it exists.
  • Start the app once in CI on the target Ubuntu image, so a missing library name fails the pipeline instead of a user's machine.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.