openLDAP compilation, "not a Walk in the Park" PDF Print E-mail
User Rating: / 2
Written by Michael Felt   

After a question on the forums, and an extra request from a manager I got more interested in examining the compliation process of openLDAP package on AIX.

Generally, compiling openSource packages is a "Walk in the Park", or "no-brainer". openLDAP required a bit of extra effort. I have my guesses as to why, but right now I am running the test. Probably before I finish typing all this, the test will be complete and I can report that as well.

Well, what is an AIX porting "Walk in the Park"? For me, the walk is the next seven steps.

  1. Download package
  2. Unpack package to project directory
  3. Scan README and INSTALL files - especially the .aix versions if included
  4. ./configure
  5. make
  6. make test
  7. su root -c "make install"

With openLDAP my walk was disturbed on step 4. After coming back from a literal walk (coffee, watching my son play football) I was dispointed to see that ./configure was not complete. There was a warning about not finding openssl (which is obviously in /usr/local/openssh) and not finding a proper version of bdb (Berkeley database). This was confusing because /usr/local/BerkeleyDB was a symbolic link to /usr/local/BerkeleyDB.4.4. More confusing, it was finding bdb version 3.3.

When confused go for the detailed notes. openLDAP also makes a file named config.log giving more detail about what it is finding and not finding. To my surprise I saw that gcc was not being used (too many openSource packages only compile with the latest version of gcc). So I: did some research; went back to step 3 and studied the README and INSTALL files; read the AIX related FAQ files on the openLDAP project site.

This resulted in following file (env) and additional substeps:
CPPFLAGS="-I/usr/local/ssl/include -I/usr/local/BerkeleyDB/include"
LDFLAGS="-L/usr/local/ssl/lib -L/usr/local/BerkeleyDB/lib"

$ . ./env
$ ./configure

And I got exactly the same results. Thinking it might be the IBM compiler (vac6 is quite an old version) I switched to gcc and got worse results - openLDAP and my gcc installation could not agree on pthread support. So I switched back to vac and started thinking more about the bdb version 3.3 rather than 4.4 as expected (and required! 4.2+ is required). And then I remembered that I also have some RPM from the IBM Toolbox for AIX repository.

# rpm -q -a

I tried just removing the db package, but python package depends on it, and I use python to keep the rootvg sitemap current. I reexamined the config.log file and also started looking the the generated libtool. What I noticed is that my environment variables were not in either of these files.

And then I realized what I was forgetting? Have you already spotted it? ./configure runs many subshells. Environment variables are not inherited by subshells unless they are exported.

So now I:
add CC=/usr/bin/vac/cc_r to the file env
$ . ./env
$ export CPPFLAGS
$ export LDFLAGS
$ ./configure

And I have a successful configuration. The next step listed in INSTALL is make depend, and the FAQ says for AIX a manual addition is required, so the next step becomes:
$ make depend MKDEP=$PWD/build/mkdep.aix
$ make
$ make test

I am running into some test errors now, so I'll get back on this later.

If you have an error while running "make test" I suggest verifying your free diskspace. Seems mine was running out. After that, the tests that could be run, ran successfully (have to read nohup.out carefully to be sure, but I am an optimist today Wink