|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49876 configure fails --with-ldap Cannot find ldap libraries in /usr/lib
Submitted: 2009-10-14 14:59 UTC Modified: 2009-10-19 13:42 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: graham dot simpson at hsbcib dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: 5.3.0 OS: SuSE Linux 10 SP 2 x86_64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
16 - 7 = ?
Subscribe to this entry?

 [2009-10-14 14:59 UTC] graham dot simpson at hsbcib dot com
64bit SuSE 10.2 with openldap2-2.3, openldap2-devel-2.3 installed.
Configure --with-ldap fails with:
checking for LDAP support... yes
checking for LDAP Cyrus SASL support... no
configure: error: Cannot find ldap libraries in /usr/lib.
rpm -q -l openldap2-devel
Should be looking in /usr/lib64. Which is odd because my LD_LIBRARY_PATH contains /usr/lib64.
Altering --with-ldap to --with-ldap=/usr or /usr/lib64, then complains about not finding the ldap.h, viz:
checking for LDAP support... yes
checking for LDAP Cyrus SASL support... no
configure: error: Cannot find ldap.h
The problem seems to be the configure script find ldap.h in /usr/include/ldap.h, so sets LDAP_LIBDIR=/usr/lib (line 52114), later it looks for /usr/lib/liblber.a instead of /usr/lib64/liblber.a.
Maybe I've got that wrong. The weird thing is I know other directives in my configure are picking up stuff from /usr/lib64.
Thanks for any help you can give.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-14 15:05 UTC] graham dot simpson at hsbcib dot com
Sorry, meant to post my configure line also...
CFLAGS="-DSYB_LP64" ./configure  --prefix=${TDIR}/php-5.3.0 --with-ldap --enable-libgcc --with-oci8 --with-pdo-oci --with-sybase-ct=${SYBASE}/${SYBASE_OCS} --with-pdo-dblib=${TDIR}/freetds-0.82 --with-curl --enable-pcntl --with-gettext --with-mcrypt --enable-soap --with-pear --with-zlib --disable-cgi --with-readline --with-bz2 --with-apxs2=${TDIR}/httpd-2.2.13/bin/apxs --with-libxml-dir=${TDIR}/libxml2-2.7.5 --with-xsl=${TDIR}/libxslt-1.1.26 --with-openssl=${TDIR}/openssl-0.9.8k
 [2009-10-19 11:14 UTC]
Your configure line is missing this: --with-libdir=lib64
 [2009-10-19 13:16 UTC] graham dot simpson at hsbcib dot com
Firstly, many thanks for picking this up.
The rest of my PHP configuration relies on libs in /usr/lib64 and that works. I didn't use --with-libdir=lib64 because my LD_LIBRARY_PATH and SHLIB_PATH include /usr/lib64 and are set to:


The problem with setting --with-libdir=lib64 is that not all software that I'm linking against has libs in lib64, some are just in lib.
 [2009-10-19 13:42 UTC] graham dot simpson at hsbcib dot com
Okay, found all the software where only lib exists and created a suitable link to lib from lib64. Specifiying the --with-libdir=lib64, now means that it compiles with the --with-ldap. Thanks for the help.
 [2011-03-01 23:58 UTC] nessunoero at libero dot it
useful howto
 [2011-11-21 09:28 UTC]
I would like to bring this up again, considering to re-open this ticket. The LDAP extension seems to be the only extension that does *not* find the header file and libraries on 64bit distros by default, i.e. without explicitly specifying the library path. This is still true for all 5.3 versions and even 5.4.0RC1.
 [2011-11-21 09:49 UTC]
Nevermind, looks like libldap seems to be the only library used for building PHP that installs into /usr/lib/x86_64-linux-gnu and does *not* provide a ldap-config script or similar to determine the actual library path, like libcurl does for example.
 [2014-02-11 08:06 UTC] vbvbrj at gmail dot com
I have to same bug with compile --with-ldap on Debian x64. LDAP libraries resides in /urs/lib/x86_64-linux-gnu . I don't want to use --with-libdir, as it breaks other paths to libs for other packages, ie --with-mysql=/opt/mysql, --with-opensll=/opt/openssl

The cnfigure script must be updated to handle this path for LDAP.
For meantime a workaround:

git checkout master;
./buildconf --force;
sed -i -e 's~^\([[:space:]]*\)\(if test -f \$LDAP_LIBDIR/liblber\.a || test -f \$LDAP_LIBDIR/liblber\.\$SHLIB_SUFFIX_NAME; then\)$~\1if test -f \$LDAP_LIBDIR/x86_64-linux-gnu/liblber\.a || test -f \$LDAP_LIBDIR/x86_64-linux-gnu/liblber\.\$SHLIB_SUFFIX_NAME; then\n\1  LDAP_LIBDIR=$LDAP_LIBDIR/x86_64-linux-gnu\n\1fi\n\n\1\2~' configure;
./configure --prefix=/opt/php --with-ldap
 [2015-04-26 15:09 UTC] 6822089 at qq dot com
configure: error: Cannot find ldap libraries in /usr/lib. 或者configure: error: Cannot find ldap.h
cd /opt/soft/php-5.6.8/ext/ldap
 ./configure  --with-php-config=/data/php/bin/php-config  --with-ldap  --with-libdir=lib64 
 [2016-01-26 16:19 UTC] keaton dot paul dot victor at gmail dot com
I found this useful, see last comment to solve issue of:

configure: error: Cannot find ldap.h
 [2017-09-13 22:09 UTC] dzuelke at gmail dot com
Anyone want to try my PR at ?
 [2018-02-08 09:43 UTC]
Automatic comment on behalf of
Log: Fixed bug #49876 lib path on 64bit distros
 [2018-02-08 09:43 UTC]
-Status: Not a bug +Status: Closed
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 08 13:05:53 2022 UTC