Monday, April 9, 2012

Compiling PHP 5.3.10 / cannot find -lltdl

When compiling php from source, some CentOS 64 bit users have reported getting an error like this:
Code:
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
Now, this error can be triggered in a couple different places and if you do a general Google search you'll get all kinds of advice about installing this or that module. All great advice, but not your solution. Here's what you need to do:
  1. Verify that the libtool and libtool-ltdl packages are installed.
  2. Symlink libltdl.so to libltdl.so.x.x.x

Step one is easy.
Code:
[root@panama ~]# yum install libtool-ltdl.x86_64 libtool.x86_64
However, note that if you have libtool already installed, if you 'yum info libtool*,' yum wont list any of the related packages. I don't know why this is or how to fix it (or if you even want it fixed) -- I simply didn't investigate. Just know that you'll have to manually execute the aforementioned statement. The '.x86_64' might be redundant if libtool has already been installed. Make sure to install libtool-ltdl though!

Step two took me a while to figure out. Apparently PHP looks for the libltdl library only at (for x64 at least) /usr/lib64/libltdl.so. The symlink to this file is not included in the libtool packages (for what reason I don't know -- but apparently this has been true and been stumping people since early 2006[1]) so you'll have to make it yourself. Execute:

Code:
[root@panama ~]# cd /usr/lib64
[root@panama lib64]# ln -s libltdl.so.3.1.4 libltdl.so
And that's it. PHP should configure and compile without error. Well, without this particular error at least.

I hope the time you save reading this will make up for my wasted evening.

http://forums.deftechgroup.com/showthread.php?t=3264 

No comments:

Post a Comment