Search code examples
c++linuxcmakemakefile

Fixing error: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libdl.so'


I have recently upgraded my OS (to PopOS! 22.04) and now a bunch of builds in my cmake workflow aren't compiling, halting at this particular error at the linking stage:

*** No rule to make target '/usr/lib/x86_64-linux-gnu/libdl.so'

This file now no longer exists. There is however a libdl.so.2.

Running apt-file search /usr/lib/x86_64-linux-gnu/libdl.so gives no output.

How can I get my builds working again?

EDIT:

The solution turned out to be due to manually built dependencies/packages that obviously weren't updated during the upgrade. I had to go and rebuild them, and then the error disappeared. Note, when rebuilding them (also with CMake) it required a full deletion of the build directory, not just running CMake again.


Solution

  • Jammy's GNU C Library version is 2.35. The dl library is now part of the C standard library. The release notes, tells that, starting from version 2.34,

    all functionality formerly implemented in the libraries libpthread, libdl, libutil, libanl has been integrated into libc. New applications do not need to link with -lpthread, -ldl, -lutil, -lanl anymore. For backwards compatibility, empty static archives libpthread.a, libdl.a, libutil.a, libanl.a are provided, so that the linker options keep working. Applications which have been linked against glibc 2.33 or earlier continue to load the corresponding shared objects (which are now empty).

    This means that you have to remove the explicit libdl.so from the linker dependencies.