curl-library
Re: Problem with libldap, liblber detection on Mac OS X
Date: Fri, 02 Feb 2007 21:00:00 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Feb 2, 2007, at 7:41 PM, Dan Fandrich wrote:
> On Fri, Feb 02, 2007 at 05:49:44PM -0500, Daniel Johnson wrote:
>> Libtool is doing
>> shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
>>
>> and
>>
>> eval std_shrext=\"$shrext_cmds\"
>>
>> so if $module is yes $std_shrext is .so.
>>
>> Liberal application of echos in configure shows that this is indeed
>> happening.
>
> I take it the resulting .so extension means that $module = yes is
> true.
>
>> Well, curl isn't linking to it since it's being dlopened. The actual
>
> Right, but configure looks for the library that would be linked if it
> were linking directly, then follows symbolic links to find the
> dynamic dlopen name.
>
>> library is /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP
>> and both are symlinked to it.
>>
>> lrwxr-xr-x 1 root wheel 57 Dec 20 19:47 /usr/lib/liblber.dylib -
>>> /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP
>> lrwxr-xr-x 1 root wheel 57 Dec 20 19:47 /usr/lib/libldap.dylib -
>>> /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP
>
> Do you have the LDAP development package (or whatever the
> Darwin equivalent is) installed which provides a library against which
> an application can directly link? It's been a while since I looked
> at how Apple does that, exactly.
Yeah, all SDKs are installed. Quick Darwin lesson. Apple often
bundles libraries into frameworks, which are just directories with a
standard structure that contain the dynamic library, headers and any
support files. In this case the library is the file called LDAP. You
can link to the LDAP framework using gcc -framework LDAP. But since
must unixy programs don't know about frameworks, Apple will also put
symlinks to the library file in /usr/lib and give it a .dylib
extension. So you can also link to LDAP by using gcc -lldap and the
linker will follow the /usr/lib/libldap.dylib symlink to the framework.
So curl needs to pass either /System/Library/Frameworks/
LDAP.framework/Versions/A/LDAP (the actual library) or simply
libldap.dylib to dlopen. If no "/" appears in the path, dlopen will
automatically search /usr/lib. You can alternatively link directly
with the standard -lldap.
Daniel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)
Comment: http://homepage.mac.com/danielj7/publickey.txt
iD8DBQFFw+yg4sDFGYouOqARAm8LAJ0VAXJ5P7DHYnyWLmxWOlZur1SGkQCfSpKS
su0TbdFA+5T58/mgHezYzwU=
=z3oy
-----END PGP SIGNATURE-----
Received on 2007-02-03