Wednesday, March 26, 2008

Compiling PerLDAP on Solaris 10

To compile PerLDAP 1.5.2, which is part of the Mozilla Directory (LDAP) SDK Project, with the Sun Studio Compilers on Solaris 10u4 (sparc) using the native perl (5.8.4), retrieve the following components:

  • The 32-bit LDAP C SDK.
    • Currently, precompiled binaries exist for v6.02
    • Source is available for v6.05
  • The latest version of PerLDAP
    • Currently, v1.5.2 is available
  • Sun Studio Compilers
    • Available for free to SDN (Sun Developer Network) members, for which membership is free
    • At a minimum, install the C & C++ compilers with the build tools.
    • v12m1 (09/2007) is the latest currently available

To install the precompiled version of the LDAP C SDK simply gunzip and untar the package and move the resulting directory to '/usr/local/ldap-sdk'. There is a self explanatory installer included with the Sun Studio compilers. Following installation, confirm that you have the Sun Studio compilers installed porperly:
z4-obx# cc -V
cc: Sun C 5.9 SunOS_sparc 2007/05/03
usage: cc [ options] files. Use 'cc -flags' for details

z4-obx# CC -V

CC: Sun C++ 5.9 SunOS_sparc 2007/05/03

Now, gunzip and untar the PerLDAP package and change into the source directory and type 'perl Makefile.PL'. It will now ask you where your LDAP SDK is located, on this line type:
/usr/local/ldap-sdk

Accept the defaults for the remaining options. Once this is done, modify the 'Makefile' so the following lines look like this:
INC = -I/usr/local/ldap-sdk/include -I/usr/include/mps

LDLOADLIBS = -L/usr/local/ldap-sdk/lib -lssldap60 -lprldap60 -lldap60 -lssl3 -lnss3 -lsoftokn3 -lplds4 -lsasl -lplc4 -lnspr4


The 'LDLOADLIBS' and 'INC' variables should each be on a single line. These changes are necessary so that the module successfully compiles and the built-in tests run without failing.

Once this is done run 'make test' on the command line and the package should be successfully built and tested. At this point, type 'make install' and the package will be made available on the server.

There is some nice documentation available here regarding utilizing PerLDAP. Also, it is worth noting that PerLDAP is not Perl-LDAP.



No comments: