Software⏱️ 3 min readπŸ“… 2026-06-11

How to Fix: php build error: /usr/bin/ld: cannot find -lltdl

Error fixing ld cannot find -lltdl in php build process.

Quick Answer: The issue is likely due to missing libtld library. Try installing libtld-dev package or using a package manager like apt-get or yum to resolve the issue.

The error '/usr/bin/ld: cannot find -lltdl' occurs when the Linux system is unable to locate the 'libtldl' library, which is required by the PHP extension 'mcrypt'. This issue affects users who are building and installing PHP from source on their Linux systems.

This error can be frustrating for developers and builders as it prevents them from completing the build process. However, with the right steps and tools, the problem can be resolved, allowing users to successfully install and use the PHP 'mcrypt' extension.

πŸ’‘ Why You Are Getting This Error

  • The primary reason for this error is that the 'libtldl' library is not installed or present on the system. This library is required by the PHP 'mcrypt' extension, which is being built from source.
  • Another possible cause could be a misconfiguration of the system's library path or an incorrect installation of the 'libtldl' library.

πŸ”§ Proven Troubleshooting Steps

Installing libtldl using package manager

  1. Step 1: Step 1: Open a terminal and update the package list by running the command 'sudo apt-get update'. This ensures that you have access to the latest package information.
  2. Step 2: Step 2: Install the 'libtldl' library using the package manager. For Debian-based systems, run the command 'sudo apt-get install libtldl-dev'. For Red Hat-based systems, use 'sudo yum install libtldl-devel'.
  3. Step 3: Step 3: Verify that the 'libtldl' library has been installed successfully by running the command 'ldd /usr/lib/libtldl.so.1' (or the equivalent for your system).

Installing libtldl manually from source

  1. Step 1: Step 1: Download the 'libtldl' library source code from a repository such as GitHub or the official website. For this example, we'll use the GitHub repository.
  2. Step 2: Step 2: Extract the downloaded archive to a temporary directory using the command 'tar -xzf libtldl-1.0.3.tar.gz'.
  3. Step 3: Step 3: Build and install the 'libtldl' library by running the commands 'cd libtldl-1.0.3 && ./configure && make && sudo make install'.

✨ Wrapping Up

After following these steps, you should be able to resolve the '/usr/bin/ld: cannot find -lltdl' error and successfully build and install the PHP 'mcrypt' extension.

Did this fix your problem?

If not, try searching for specific error codes.

πŸ” Search Error Database

❓ Frequently Asked Questions